I've been escaping single quote characters in all my text fields and using
the sqlite_execute function to put the data into the table. But is it
possible to use the prepare/bind commands to enter data so that I don't have
to do this?
I've been using the column_text type to get back a block of
flakpit [EMAIL PROTECTED]
wrote in message news:[EMAIL PROTECTED]
I've been escaping single quote characters in all my text fields and
using the sqlite_execute function to put the data into the table. But
is it possible to use the prepare/bind commands to enter data so that
I don't have to do
Yep. Works great! For example:
sqlite3_prepare_v2(db,INSERT INTO ans VALUES (?,?);,-1,stmt,NULL);
sqlite3_bind_text(stmt,0,Peter's,-1,SQLITE_STATIC);
sqlite3_bind_text(stmt,1,Reply,-1,SQLITE_STATIC);
sqlite3_step(stmt);
sqlite3_reset(stmt);
flakpit wrote:
I've been escaping single quote
Make that:
sqlite3_prepare_v2(db,INSERT INTO ans VALUES (?,?);,-1,stmt,NULL);
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
DOH!
sqlite3_prepare_v2(db,INSERT INTO ans VALUES (?,?);,-1,stmt,NULL);
sqlite3_bind_text(stmt,1,Peter's,-1,SQLITE_STATIC);
sqlite3_bind_text(stmt,2,Reply,-1,SQLITE_STATIC);
sqlite3_step(stmt);
sqlite3_reset(stmt);
I'll shut up now...
___
sqlite-users
flakpit [EMAIL PROTECTED]
wrote in message news:[EMAIL PROTECTED]
I've been using the column_text type to get back a block of text and it's
being truncated at the first CR/LF pair in the text block and I can't help
thinking that I could have avoided this somehow by entering it with a
prepared
SQLite doesn't truncate anything. Either you truncated at the time you
put the data into the database in the first place, or you are truncating
now when looking at the string.
It definately wasn't truncated when I put it in, I checked. So as you say,
something is truncating it as it is
Peter Holmes-4 wrote:
Yep. Works great! For example:
sqlite3_prepare_v2(db,INSERT INTO ans VALUES (?,?);,-1,stmt,NULL);
sqlite3_bind_text(stmt,0,Peter's,-1,SQLITE_STATIC);
sqlite3_bind_text(stmt,1,Reply,-1,SQLITE_STATIC);
sqlite3_step(stmt);
sqlite3_reset(stmt);
so ?,? represent
Enrique Ramirez-3 wrote:
Depends on where you're looking at your block of text. Are you using a
GUI SQLite Manager of sorts, or maybe peeking at the variable's
contents from a dev IDE?
I checked the contents of the db to ensure that all my text was in it and it
was. Then I peek the
flakpit wrote:
Peter, sorry to be a nuisance but, can you update the same way?
Yes, of course.
I've not
idea how that statement would look with this way of doing things
SQLite has copious and well written documentation. You would be well
served by reading it rather than trying to
Dennis Cote wrote:
See, http://www.sqlite.org/c3ref/prepare.html for details on prepare and
previous link for detail on bind_text.
Dennis Cote
Thank you for the links Dennis, this will help me a lot.
--
View this message in context:
flakpit wrote:
Peter Holmes-4 wrote:
Yep. Works great! For example:
sqlite3_prepare_v2(db,INSERT INTO ans VALUES (?,?);,-1,stmt,NULL);
sqlite3_bind_text(stmt,0,Peter's,-1,SQLITE_STATIC);
sqlite3_bind_text(stmt,1,Reply,-1,SQLITE_STATIC);
sqlite3_step(stmt);
sqlite3_reset(stmt);
so
flakpit wrote:
Peter, sorry to be a nuisance but, can you update the same way? I've not
idea how that statement would look with this way of doing things
Yep:
sqlite3_prepare_v2(db,UPDATE ans SET col1=?, col2=?;,-1,stmt,NULL);
sqlite3_bind_text(stmt,1,Peter's,-1,SQLITE_STATIC);
13 matches
Mail list logo