I am out of necessity using the SQLite3 shell tool to maintain a small database. Of all the response modes available, using -header -ascii seems to return the most efficient representation of data (for parsing and size) with the required column headers. However, I haven't yet found a way to avoid ambiguity over the type of any one value returned. Consider the following:
Create Table `things` (`number` Integer, `string` Text, `binary` Blob);
Insert Into `things` (`number`,`string`,`binary`) Values (4,'4',X'34');
Select * From `things`;
This returns (using caret notation):
number^_string^_binary^^4^_4^_4^^
As is evident, there is no way to infer the type of any of the '4' characters as none of them have distinguishing delimiters.
Is there any way to coerce the inclusion of type metadata into the response? I don't want to have to resort to e.g. prefixing each text or blob value with a type id as clearly that will have implications on other operations over the database and impedes interoperability. Ideally it would be included with the header line, though if there was a way to prefix text or blob value only as part of the response, that would be acceptable too (probably more likely as type is ascribed to values, not columns):
number (Integer)^_string (Text)^_binary (Blob)^^4^_4^_4^^
number^_string^_binary^^4^_'4'^_X'4'^^
Aucun commentaire:
Enregistrer un commentaire