[sqlite] A lillte help adding sqlite to a c program

2006-09-09 Thread Lloyd Thomas
I know nothing of C++ and therefore need a lilte help editing a C++ app to insert some records into a database. This is where I am so far #include sqlite.h sqlite *db; //insert record into database

Re: [sqlite] A lillte help adding sqlite to a c program

2006-09-09 Thread Mark Richards
Maybe. Here's what I do (in c). DoSql() is a wrapper function. I've included a callback function (and associated structure) below it. The call is made thusly: static char cData[1024]; char query[255]; snprintf(query, QUERY_SIZE, SELECT * FROM inikeys WHERE inisection = \%s\ AND

Re: [sqlite] A lillte help adding sqlite to a c program

2006-09-09 Thread Jay Sprenkle
On 9/9/06, Lloyd Thomas [EMAIL PROTECTED] wrote: I know nothing of C++ and therefore need a lilte help editing a C++ app to insert some records into a database. here's an example to read from a database. If you build the sql like you're doing and you use it on the web you leave yourself open

Re: [sqlite] Reg number of tables.

2006-09-09 Thread Jay Sprenkle
On 9/8/06, chetana bhargav [EMAIL PROTECTED] wrote: Hi, I wanted to know will there be any performance impact if the number of tables in a DB grow. I am planning to have around 8-9 tables in a single DB, so want to make sure does it have any affect. Is there any number for optimal usage.

Re: [sqlite] A lillte help adding sqlite to a c program

2006-09-09 Thread Lloyd Thomas
Jay, Thanks for your reply. I gave it a try with and got a few errors. as follows --- logger.cpp:609: error: invalid operands of types `const char[80]' and `char[4]' to binary `operator+' logger.cpp:615: error: `t' was not declared in

Re: [sqlite] A lillte help adding sqlite to a c program

2006-09-09 Thread Mark Richards
I don't know how to work string types in c++, but it looks like you need to initialize an integer t=0, or replace sql[t] with sql[0] perhaps? /m Lloyd Thomas wrote: Jay, Thanks for your reply. I gave it a try with and got a few errors. as follows

Re[2]: [sqlite] A lillte help adding sqlite to a c program

2006-09-09 Thread Teg
Hello Lloyd, You need to escape the quotes. Remember in C and C++ means the beginning or end of a literal string so, when you want to embed quotes in a string you have to escape them. Probaby \. You'd be better off using the paramaterized version of the SQL std::string sql = insert into

Re: Re[2]: [sqlite] A lillte help adding sqlite to a c program

2006-09-09 Thread Lloyd Thomas
if I could somehow create the following string as a char i cpuld probably get the code to work. sql = insert into call_data (direction, call_time, dest, trunk_no, file_name)values('; sql += details.inout; sql += ','; sql += details.statime; sql +=

Re[4]: [sqlite] A lillte help adding sqlite to a c program

2006-09-09 Thread Teg
Hello Lloyd, I gave you the answer, you just don't want to use it. Generating SQL this way is painful, messy and error prone. SQLite already has a far better mechanism for doing it using late binding of the parameters. How about learning the right way to do this? I'll give you a hint though