Re: [sqlite] Ascii data in string treated as a num

2007-07-19 Thread drh
"Michael Flum" <[EMAIL PROTECTED]> wrote:
> I have a short program that requires storing of Ascii strings that
> happen to be numbers. It seem that when I retrieve the data it has been
> interrupted as a numeric value and is returned altered. I.E. "0E00" is
> returned as "0", "" is returned as "0",  "76E0" is returned as "76"
> 
>SQL_Write( db, "CREATE TABLE P ( ENCODING INTEGER PRIMARY KEY UNIQUE,
> ST STRING, EN STRING, SW STRING,DW STRING,BX STRING);" );
> 

Use TEXT instead of STRING as the column datatype.

--
D. Richard Hipp <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] Ascii data in string treated as a num

2007-07-19 Thread Gerry Snyder

Michael Flum wrote:

I have a short program that requires storing of Ascii strings that
happen to be numbers. It seem that when I retrieve the data it has been
interrupted as a numeric value and is returned altered. I.E. "0E00" is
returned as "0", "" is returned as "0",  "76E0" is returned as "76"

 


Thanks for any help in advance.

 


   SQL_Write( db, "CREATE TABLE P ( ENCODING INTEGER PRIMARY KEY UNIQUE,
ST STRING, EN STRING, SW STRING,DW STRING,BX STRING);" );

  


Try defining the columns as TEXT rather than STRING.

http://www.sqlite.org/datatype3.html


HTH,

Gerry



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Ascii data in string treated as a num

2007-07-19 Thread Michael Flum
I have a short program that requires storing of Ascii strings that
happen to be numbers. It seem that when I retrieve the data it has been
interrupted as a numeric value and is returned altered. I.E. "0E00" is
returned as "0", "" is returned as "0",  "76E0" is returned as "76"

 

Thanks for any help in advance.

 

   SQL_Write( db, "CREATE TABLE P ( ENCODING INTEGER PRIMARY KEY UNIQUE,
ST STRING, EN STRING, SW STRING,DW STRING,BX STRING);" );

 

sprintf(sql_statment,"INSERT INTO P VALUES(
%d,\'%s\',\'%s\',\'%s\',\'%s\',\'%s\');", evalue, pt[0], pt[1], pt[2],
pt[3], pt[4]);

 

Example: INSERT INTO P VALUES(
21,'0E00','','7E00','1234','NOVALUE');

 

Returned:   21, '0','0','7','1234','NOVALUE'

 

Michael Flum

Software Engineer

Haas Automation, Inc.