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

[sqlite] Prepare statement in separate function

2011-10-11 Thread enjoythesun
hello list, I have a question regarding prepared statements. I'm fairly new to sqlite3 and it's already pretty late, so if I'm overlooking something obvious please forgive me :) I'm on Windows 7 x64 and using sqlite-3070800 (amalgamation). I'm trying to prepare an insert statement, that I

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

[sqlite] Prepare Statement

2008-03-01 Thread Mahalakshmi.m
Can anyone please help to solve this. Regards, Mahalakshmi -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stephen Oberholtzer Sent: Friday, February 29, 2008 2:54 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] Prepare Statement O

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

[sqlite] Prepare Statement

2008-02-28 Thread Mahalakshmi.m
Hi, My table looks like: IdName 1 1aaa 2 01345 3 1asdf I want the statement to be like: "SELECT id, Name FROM MUSIC WHERE Name >= '1a' LIMIT 1;" But using prepare I could not able to get the desired

[sqlite] Sqlite Prepare Statement

2007-08-30 Thread RaghavendraK 70574
Hi, Do we have tool(similar to Sqlite3) by which Prepare statement can be tested as easily as normal sql ? As most of the time we have use Prepare statement hence we need a RAD tool to verify it.This will be useful to the Sqlite grp.Share your opinion. Or if any have an idea how to do it,let me

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

[sqlite] PREPARE statement tutorial?

2006-04-06 Thread Olaf Beckman Lapré
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