Dear All,
I'm migrating an Access Application to Sqlite.
In MS Access I had a Memo field which now is Sqlite is a clob (datatype)
With the Access ODBC I can insert a text like this: "
Sqlite with PB 4.20 b6. UTF8
Sqlite with PB 4.20 b6. UTF8
Last edited by mcsalsa on Tue May 20, 2008 7:52 am, edited 2 times in total.
I'm not 100% sure I'm understanding the question but you can insert using hex if you want to using the X'<hex goes here>' format.
http://www.purebasic.fr/english/viewtop ... qlite+blob (ignore the rest of th code on this link but the insert part and hex data.)
There's a Bin2Hex() function there too, you can pass a string pointer there I guess
http://www.purebasic.fr/english/viewtop ... qlite+blob (ignore the rest of th code on this link but the insert part and hex data.)
There's a Bin2Hex() function there too, you can pass a string pointer there I guess
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
Thanks pdwyer for the answer.
My question goes about inserting and retrieving strings in which some of the characters are with ascii codes lower that 21.
One option I'm thinking is if it possible to inform SQlite to convert the string to UTF8 once you make the insert, because I can retrieve without problems.
Regards,
My question goes about inserting and retrieving strings in which some of the characters are with ascii codes lower that 21.
One option I'm thinking is if it possible to inform SQlite to convert the string to UTF8 once you make the insert, because I can retrieve without problems.
Regards,
if you use blobs, hex and pointers it will just hold whatever you put in it however you put it in and you can get it out the same way. (get a pointer back when you select out of a blob and peeks() it to your string) you can even have chr(0) in there up till the point that you use PB string functions at which time they will concaternate
BUT
I haven't really looked into the PB SQLite implementation stuff to see if all the commands are available or usable, its not my intention to use it till it's out of beta, I'm on 4.10 still
BUT
I haven't really looked into the PB SQLite implementation stuff to see if all the commands are available or usable, its not my intention to use it till it's out of beta, I'm on 4.10 still
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
All right, I will put an example, in order to explain my problem better.
If you create a string like this:
s$=Chr(15)+Chr(8)+Chr(134)
then make the insert into a database. string1 is a varchar of 1200 chars
ssql.s="insert into table1 (string1) values ('" + s$ + "')"
DatabaseUpdate(0,ssql)
then if you retrieve the string back and do something like this
ssql.s="Select string1 from table1"
If DatabaseQuery(0,auxs)
If NextDatabaseRow(0)
cadena$=GetDatabaseString(0,0)
For i=1 To Len(cadena$)
Debug Asc(Mid(cadena$,i,1))
Next
EndIf
EndIf
The values that i get are: 15, 8, 194, 134. What am I doing wrong in order to get that "194", that is an extra value.
Thanks for your understanding.
If you create a string like this:
s$=Chr(15)+Chr(8)+Chr(134)
then make the insert into a database. string1 is a varchar of 1200 chars
ssql.s="insert into table1 (string1) values ('" + s$ + "')"
DatabaseUpdate(0,ssql)
then if you retrieve the string back and do something like this
ssql.s="Select string1 from table1"
If DatabaseQuery(0,auxs)
If NextDatabaseRow(0)
cadena$=GetDatabaseString(0,0)
For i=1 To Len(cadena$)
Debug Asc(Mid(cadena$,i,1))
Next
EndIf
EndIf
The values that i get are: 15, 8, 194, 134. What am I doing wrong in order to get that "194", that is an extra value.
Thanks for your understanding.