Hi Cory,

Alright I gave it a shot from the docs but I'm not handling the
prepare statement correctly. I'm trying the ASCI version first. The
prepare statement returns an error. Here is the code snippet I'm
trying:


strSql.Format("CREATE TABLE test (something TEXT, something_else TEXT,
primary key(something))");

   sqlite3_stmt *pStmt;
   const char *pszTailPointer;
   int nRetVal = sqlite3_prepare(db, strSql, strSql.GetLength(),
&pStmt, &pszTailPointer);
   while (nRetVal == SQLITE_BUSY || nRetVal == SQLITE_ROW) {
       Sleep(100);
       // Try again.
       nRetVal = sqlite3_step(pStmt);
       TRACE("ret val was [%i]\n", nRetVal);
   }
   switch (nRetVal) {
       case SQLITE_DONE:
           TRACE("Done ok\n");
           break;
       case SQLITE_ERROR:
           TRACE("ERROR!!!!\n");
           break;
       case SQLITE_MISUSE:
           TRACE("MISUSE!!!!\n");
           break;
       default:
           break;
   }
   sqlite3_finalize(pStmt);
   return true;

Any hints?

Thanks,
Mark


On 8/13/06, Cory Nelson <[EMAIL PROTECTED]> wrote:
On 8/13/06, Mark Wyszomierski <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have been using sqlite on windows for a few months, it is great. I
> need to switch over to unicode support now though, and I am confused
> how to do this with sqlite.
>
> 1) First, when I compiled the original sqlite project, I have the
> character set to MBCS. Should I switch this to Unicode and recompile?

I think SQLite explicitly calls CreateFileW but I could be wrong.
Might as well compile as Unicode anyway.

> 2) I have been using sqlite3_exec() to execute my sql statements, but
> I see that there is no sqlite3_exec16() equivalent to take a unicode
> string. I think I'm supposed to use sqlite3_prepare16() but I have no
> idea what the last two parameters of that function are?

Check the docs, they explain how to use prepared statements.

> 3) To escape my sql statements I was using sqlite3_mprintf() - is
> there a unicode equivalent?

With prepared statements you put placeholders like "?" into your sql
and bind data to the placeholders - no escaping required.

> Thanks for any information,
> Mark
>
> -----------------------------------------------------------------------------
> To unsubscribe, send email to [EMAIL PROTECTED]
> -----------------------------------------------------------------------------
>
>


--
Cory Nelson
http://www.int64.org

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to