Re: [sqlite] Prepare statement in separate function

2011-10-12 Thread Igor Tandetnik
enjoythe...@hushmail.com wrote: > I was allocating memory because I wanted to prepare the statement > in a separate function. Just prepare the statement, and return sqlite3_stmt* by value. You are not allocating memory when returning, say, an int, right? sqlite3_stmt* is comparable in size, and

Re: [sqlite] Prepare statement in separate function

2011-10-12 Thread enjoythesun
hello martin, I was allocating memory because I wanted to prepare the statement in a separate function. After all I have changed the whole implementation design to something less awkward :) greetings, john On Tue, 11 Oct 2011 11:46:01 +0200 Martin Engelschalk

Re: [sqlite] Prepare statement in separate function

2011-10-11 Thread Martin Engelschalk
Hello John, why do you malloc() your DB- and Statement handle? I declare a sqlite3* pDB; sqlite3_stmt* pStmnt; then open the database with int nRet = sqlite3_open("MyDatabaseName", ); and prepare a statement using nRet = sqlite3_prepare_v2(pDB, "insert .", -1, , ); no need to malloc

Re: [sqlite] Prepare statement in separate function

2011-10-11 Thread enjoythesun
hello again, ok, right after posting to the list, I have found the mistake. Obviously it needs to be: sqlite3_stmt** stmt = (sqlite3_stmt**) malloc (sizeof(sqlite3_stmt*)); thanks list! :) On Tue, 11 Oct 2011 11:27:41 +0200 enjoythe...@hushmail.com wrote: >hello list, > >I have a question

Re: [sqlite] Prepare Statement

2008-03-01 Thread Igor Tandetnik
"Mahalakshmi.m" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Can I bind the unsigned short value [ie., like 0x0065 for English and > 0x3045 > for Japanese] to its corresponding string value.is it possible. > > Unsigned short temp; > For eg, > If temp = 0x0065 then its

Re: [sqlite] Prepare Statement

2008-02-28 Thread Stephen Oberholtzer
On Thu, Feb 28, 2008 at 9:22 AM, Mahalakshmi.m <[EMAIL PROTECTED]> wrote: > > > Hi, > My table looks like: > IdName > 1 1aaa > 2 01345 > 3 1asdf > > I want to bind unsigned short as text. i.e, If the Unsighed short

Re: [sqlite] Prepare Statement

2008-02-28 Thread Igor Tandetnik
Simon Davies <[EMAIL PROTECTED]> wrote: > You need a placeholder in the SQL in order to bind a value. > > "SELECT id, Name FROM MUSIC WHERE Name >= '?' LIMIT 1;", '?' is a string literal consisting of a single question mark character - _not_ a parameter placeholder. You want ? without quotes.

Re: [sqlite] Prepare Statement

2008-02-28 Thread Steven Fisher
On 28-Feb-2008, at 6:22 AM, Mahalakshmi.m wrote: > if ( sqlite3_prepare(gpst_SqliteInstance,"SELECT id, Name FROM MUSIC > WHERE > Name >= '%d%c' LIMIT 1;",-1,_SearchPrepareStmt,0)!= SQLITE_OK) That's not what a bind point looks like. Take a look here:

Re: [sqlite] Prepare Statement

2008-02-28 Thread John Stanton
You misunderstand binding. You use it like this - sql - "SELECT name FROM customers WHERE cust_id = ?"; this_cust_id - "CUST1275"; sqlite3_prepare_v2(...); sqlite3)bind_text(..., 1, this_cust_id, ...); You bind a value to the data represented by the ?. Then you reuse the

Re: [sqlite] PREPARE statement tutorial?

2006-04-06 Thread Dennis Cote
Olaf Beckman Lapré wrote: Hi, I assume that the sqlite3_prepare() / sqlite3_bind() combination results in faster performance than sqlite3_exec() for INSERT and UPDATE statements. But where can I find example code that uses prepare/bind? Googling didn't give any results. Greetz, Olaf