Re: [sqlite] sqlite3.exe and formatting binary (GUID) data

2009-05-25 Thread Philip Warner
John Machin wrote:
> Assuming your guid is a BLOB, then
>SELECT other_stuff, QUOTE(guid), etc
> will display it as hex e.g. X'01020304'
>   
This is great; now I can see them at least!

>> P.S. Of course even better would be the ability to read/write GUIDs as
>> properly formatted strings! (Note: I am not asking that they be treated
>> internally as anything other than a binary chunk of data -- just the
>> text  form being changed).
>> 
>
> On output, how do you expect it to determine what blobs are guids? 
> column_name like  '%guid%' ??
>   

Yes...is that a problem? I have not really looked at the SQLite code
much. I know it remembers the declared types and assigns appropriate
internal types. My thinking was that for certain types (GUID, UUID,
maybe even Datetime/timestamp etc) it, or the user, could (optionally,
for backward compatibility) assign 'toString' and 'fromString'
operators. ie. not promote the to full types, but assign them a
quasi-type status.

In the case of dates, for example, it would allow me to enter
'1-Jan-1970' and fromString would produce '1970-01-01'. In the case of
GUIDs, it would display and load them in the standard GUID
representation. This would not even necessarily need to form part of the
standard sqlite code, but could be done as plugable functions.

But, as I said, I have not really looked much at sqlite internals to
know if this is completely impractical.

> On input: does the SQL standard define a guid literal?
>   
No; but GUIDs do.


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3.exe and formatting binary (GUID) data

2009-05-24 Thread John Machin
On 25/05/2009 2:30 PM, Philip Warner wrote:

> I use binary GUID values and when I 'select' them in the sqlite3 shell,
> they display as *binary* data, often screwing up the terminal. When I
> use .dump, or use .mode tcl I get terminal-friendly output. Is there any
> simple way (or just a hack) that I could persuade the shell to output
> GUIDs (or all binary data) in the same format as for .dump?

Assuming your guid is a BLOB, then
   SELECT other_stuff, QUOTE(guid), etc
will display it as hex e.g. X'01020304'
otherwise if your guid is TEXT, all I can say is "don't do that".


> P.S. Of course even better would be the ability to read/write GUIDs as
> properly formatted strings! (Note: I am not asking that they be treated
> internally as anything other than a binary chunk of data -- just the
> text  form being changed).

On output, how do you expect it to determine what blobs are guids? 
column_name like  '%guid%' ??

On input: does the SQL standard define a guid literal?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] sqlite3.exe and formatting binary (GUID) data

2009-05-24 Thread Philip Warner
Hi,

I'm using sqlite3 and am very impressed. But, have one small problem.

I use binary GUID values and when I 'select' them in the sqlite3 shell,
they display as *binary* data, often screwing up the terminal. When I
use .dump, or use .mode tcl I get terminal-friendly output. Is there any
simple way (or just a hack) that I could persuade the shell to output
GUIDs (or all binary data) in the same format as for .dump?

Thanks,

Philip Warner

P.S. Of course even better would be the ability to read/write GUIDs as
properly formatted strings! (Note: I am not asking that they be treated
internally as anything other than a binary chunk of data -- just the
text  form being changed).

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users