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