I have been tinkering with writing an Elisp interface to SQLite via
the command line tool (since I'm not smart enough to interfere with
the guts of Emacs). As to data types, I had taken to bloating all
queries by duplicating all columns with a "typeof(column)"
statement. Having gotten this to work two days ago, I accidently
stumbled over quote(), and I have the impression that it reliably
indicates whether a value is an INTEGER, REAL, TEXT, BLOB, or
NULL. The following output from a test table:

sqlite> SELECT typeof(a),quote(a), typeof(b),quote(b) FROM vague;

integer     3           real        4.0       
text        'foo'       text        'barfu'   
real        4.0         integer     3         
text        '4'         real        5.0       
text        '4'         text        '5.0'     
text        '.4'        text        '5.0.2.3' 
real        0.4         real        3.0       
real        4000.0      real        3.0       
text        '4e3'       real        3.0       
real        -4000.0     real        3.0       
text        '-4e3'      real        3.0       
text        '-4'        real        3.0       
integer     -4          real        3.0       
blob        X'ABCD'     integer     12        
blob        X'0A0D'     text        'CRLF'    
integer     0           null        NULL      

sqlite> 

seems to confirm that the typeof() column adds no information that the
quoted value itself does not provide. 

So, can I simply use quote() on every column to determine the storage
class SQLite uses? (I'd just like to have a confirmation, before I
program the next change only to discover some glitch later.)

Thanks very much in advance,

Florian

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

Reply via email to