[sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread flakpit
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

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread Igor Tandetnik
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

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread Peter Holmes
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

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread Peter Holmes
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

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread Peter Holmes
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

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread Enrique Ramirez
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

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread flakpit
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

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread flakpit
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

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread flakpit
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

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread Dennis Cote
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

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread flakpit
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:

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread Peter Holmes
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

Re: [sqlite] SQLITE_prepare/bind to exnter data or just query?

2008-08-14 Thread Peter Holmes
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);