Don't use sqlite3_get_table. Use sqlite3_prepare_v2, sqlite3_step,
sqlite3_finalize and related APIs instead.

Mike

> -----Ursprüngliche Nachricht-----
> Von: Jonathan Hendler [mailto:[EMAIL PROTECTED] 
> Gesendet: Sonntag, 2. Dezember 2007 14:10
> An: sqlite-users@sqlite.org
> Betreff: [sqlite] Help with C API - sqlite3
> 
> Hi All,
> 
> I'm writing a C application which runs inside of FastCGI process.
> 
> The problem is that I am getting poor performance... roughly 1000
> SELECTs in 20 seconds.
> It's not an indexing issue (I promise). This is true even 
> when there are
> only 2 rows. I'm not getting errors.
> 
> PHP PDO sqlite runs about 10000 equivalent SELECTS on the 
> SAME database
> in about 2 seconds on my machine.
> 
> What could I be doing so drastically wrong?
> 
> I am using these defines to do the execution
> 
> #define SQLITE_GET_RESULTS \
>     char ** result;\
>     char * err;\
>     int rc, nrows,ncols;\
>     rc = sqlite3_get_table(db,sql,&result,&nrows,&ncols,&err);\
>     if (rc != SQLITE_OK){\
>         if(err != NULL){\
>             printf(" err %i: %s\n%s\n",rc,err,sql);\
>             sqlite3_free(err);\
>             sqlite3_free(sql);\
>              }    result = NULL; }
> 
> #define RESULT_ITERATOR(result,ncols,nrows,i,j) \
>     int i,j;\
>     for(i=0;i< nrows ;i++){\
>         for (j=0;j<ncols;j++){
> 
> #define SQLITE_RESULT_CLEANUP if (result) { 
> sqlite3_free_table(result);}
> if (sql) { sqlite3_free(sql);}
> 
> The SQL is created via sqlite3_vmprintf().
> 
> I've increased the pragmas for memory, it's a shared cache, 
> thread safe
> - though tweaking these items has not appeared to affect performance.
> 
> I can provide more relevant information with some hints about where to
> start.
> 
> Thanks in advance.
> 
> Cheers,
> Jonathan
> 
> --------------------------------------------------------------
> ---------------
> To unsubscribe, send email to [EMAIL PROTECTED]
> --------------------------------------------------------------
> ---------------
> 
> 


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

Reply via email to