RE: [sqlite] What is wrong with this simple query (offset)?
You were absolutely right, I didn't call the new dll. All solved now. RBS -Original Message- From: Trey Mack [mailto:[EMAIL PROTECTED] Sent: 07 March 2007 13:12 To: sqlite-users@sqlite.org Subject: Re: [sqlite] What is wrong with this simple query (offset)? > It looks all as it should work and it compiles with the same number of > warnings, but I get a bad dll calling convention in VB with the extra > integer argument iFields. You've changed the signature of the method you're calling, and it looks like you changed it correctly in the VB declaration. Maybe you have an older version of the DLL with the older signature in your system32 directory? It's possible this older version is being loaded, and that would cause the error you see. There's a method called sqlite_libversion in that dll that returns VB_SQLITE_VERSION (#defined in vbsql.h). Mine's "3.3.8c" now. Added the extra letter just so I could make sure I have the right version of the dll loaded. HTH, - Trey - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
RE: [sqlite] What is wrong with this simple query (offset)?
Thanks, will have a look at that, but I am sure I am calling the new dll as the declaration in VB doesn't mention the full path and I point to the dll by changing the curdir. RBS -Original Message- From: Trey Mack [mailto:[EMAIL PROTECTED] Sent: 07 March 2007 13:12 To: sqlite-users@sqlite.org Subject: Re: [sqlite] What is wrong with this simple query (offset)? > It looks all as it should work and it compiles with the same number of > warnings, but I get a bad dll calling convention in VB with the extra > integer argument iFields. You've changed the signature of the method you're calling, and it looks like you changed it correctly in the VB declaration. Maybe you have an older version of the DLL with the older signature in your system32 directory? It's possible this older version is being loaded, and that would cause the error you see. There's a method called sqlite_libversion in that dll that returns VB_SQLITE_VERSION (#defined in vbsql.h). Mine's "3.3.8c" now. Added the extra letter just so I could make sure I have the right version of the dll loaded. HTH, - Trey - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] What is wrong with this simple query (offset)?
It looks all as it should work and it compiles with the same number of warnings, but I get a bad dll calling convention in VB with the extra integer argument iFields. You've changed the signature of the method you're calling, and it looks like you changed it correctly in the VB declaration. Maybe you have an older version of the DLL with the older signature in your system32 directory? It's possible this older version is being loaded, and that would cause the error you see. There's a method called sqlite_libversion in that dll that returns VB_SQLITE_VERSION (#defined in vbsql.h). Mine's "3.3.8c" now. Added the extra letter just so I could make sure I have the right version of the dll loaded. HTH, - Trey - To unsubscribe, send email to [EMAIL PROTECTED] -
RE: [sqlite] What is wrong with this simple query (offset)?
uot;3.3.13" /* Source Code Version */ SAFEARRAY * __stdcall sqlite_get_table(sqlite3 * , const char *, BSTR *, int); BSTR __stdcall sqlite_libversion(void); int __stdcall number_of_rows_from_last_call(void); And this my function in VB: Private Declare Function sqlite_get_table _ Lib "SQLite3VB.dll" _ (ByVal DB_Handle As Long, _ ByVal SQLString As String, _ ByRef ErrStr As String, ByVal iFields As Long) As Variant() Have tried ByRef iFields as long as well, but same error. Any obvious mistakes here? I know this is not that much to do with SQLite, but maybe it is something simple I am doing wrong and somebody could tell me, other than that I should learn C first. RBS -Original Message- From: RB Smissaert [mailto:[EMAIL PROTECTED] Sent: 06 March 2007 23:14 To: sqlite-users@sqlite.org Subject: RE: [sqlite] What is wrong with this simple query (offset)? OK, forget about this, I think I am nearly there. RBS -Original Message- From: RB Smissaert [mailto:[EMAIL PROTECTED] Sent: 06 March 2007 22:42 To: sqlite-users@sqlite.org Subject: RE: [sqlite] What is wrong with this simple query (offset)? Could I ask if somebody could tell me how I add an optional Boolean argument to this: SAFEARRAY * __stdcall sqlite_get_table( sqlite3 *db, /* The database on which the SQL executes */ const char *zSql, /* The SQL to be executed */ BSTR *ErrMsg /* Write error messages here */ ) /* Return the SAFEARRAY */ I had a go, but I know nil about C and it isn't that simple. Once I have the Boolean argument (variable) I probably manage to do the if To either put the fields in the array or leave them out. RBS -Original Message- From: RB Smissaert [mailto:[EMAIL PROTECTED] Sent: 06 March 2007 21:45 To: sqlite-users@sqlite.org Subject: RE: [sqlite] What is wrong with this simple query (offset)? Yes, I can see now where this happens: TempWideDataHolder = CoTaskMemAlloc(1); // Set up array bounds SA_Bounds[0].cElements = NumberRows + 1; SA_Bounds[0].lLbound = 0; SA_Bounds[1].cElements = NumberofCols; SA_Bounds[1].lLbound = 0; //Create array resultp = SafeArrayCreate(VT_VARIANT, 2, SA_Bounds); // Start Place column headers in first row for (intCurrentColumn=0;intCurrentColumn< (ULONG)NumberofCols ;intCurrentColumn++) { long indices[] = {0,intCurrentColumn}; VariantInit(&tmpVariant); // Start Convert to unicode WideCharacterLength=strlen(SQL_Results[intCurrentColumn]) + 1 ; *TempWideDataHolder = (LPOLESTR) CoTaskMemAlloc(WideCharacterLength*2); MultiByteToWideChar( CP_ACP, 0, SQL_Results[intCurrentColumn], strlen(SQL_Results[intCurrentColumn])+1, *TempWideDataHolder, WideCharacterLength ); //Convert the VT_Object element to the BSTR - Here we may change if SQLite type casts tmpVariant.bstrVal=SysAllocString(*TempWideDataHolder); V_VT(&tmpVariant) = VT_BSTR; CoTaskMemFree(*TempWideDataHolder); // End convert to unicode // Safearray Column headers hr = SafeArrayPutElement(resultp, indices, &tmpVariant); SysFreeString(tmpVariant.bstrVal); VariantClear(&tmpVariant); } // End Place column headers in first row // Start Loop through array and fill SAFEARRAY for (intCurrentRow=1;intCurrentRow<=(ULONG)NumberRows ;intCurrentRow++) { for (intCurrentColumn=0;intCurrentColumn< (ULONG)NumberofCols ;intCurrentColumn++) { long indices[] = {intCurrentRow , intCurrentColumn}; // set return array index VariantInit(&tmpVariant); sqlite_return_array_int= (intCurrentRow * (ULONG)NumberofCols) + intCurrentColumn ; // Start Convert to unicode if (SQL_Results[sqlite_return_array_int]) { WideCharacterLength=strlen(SQL_Results[sqlite_return_array_int]) + 1 ; *TempWideDataHolder= (LPOLESTR) CoTaskMemAlloc(WideCharacterLength*2); MultiByteToWideChar( CP_ACP, 0, SQL_Results[sqlite_return_array_int], strlen(SQL_Results[sqlite_return_array_int])+1, *TempWideDataHolder, WideCharacterLength ); //Convert the VT_Object element to the BSTR - //Here we may change if SQLite type casts tmpVariant.bstrVal=SysAllocString(*TempWideDataHolder); V_VT(&tmpVariant) = VT_BSTR; CoTaskMemFree(*TempWideDataHolder); // End convert to unicode hr = SafeArrayPutElement(resultp, indices, &tmpVariant); SysFreeString(tmpVariant.bstrVal); VariantClear(&tmpVariant); } } } // END Loop through array and fill SAFEARRAY } } else { *ErrMsg = SysAl
RE: [sqlite] What is wrong with this simple query (offset)?
OK, forget about this, I think I am nearly there. RBS -Original Message- From: RB Smissaert [mailto:[EMAIL PROTECTED] Sent: 06 March 2007 22:42 To: sqlite-users@sqlite.org Subject: RE: [sqlite] What is wrong with this simple query (offset)? Could I ask if somebody could tell me how I add an optional Boolean argument to this: SAFEARRAY * __stdcall sqlite_get_table( sqlite3 *db, /* The database on which the SQL executes */ const char *zSql, /* The SQL to be executed */ BSTR *ErrMsg /* Write error messages here */ ) /* Return the SAFEARRAY */ I had a go, but I know nil about C and it isn't that simple. Once I have the Boolean argument (variable) I probably manage to do the if To either put the fields in the array or leave them out. RBS -Original Message- From: RB Smissaert [mailto:[EMAIL PROTECTED] Sent: 06 March 2007 21:45 To: sqlite-users@sqlite.org Subject: RE: [sqlite] What is wrong with this simple query (offset)? Yes, I can see now where this happens: TempWideDataHolder = CoTaskMemAlloc(1); // Set up array bounds SA_Bounds[0].cElements = NumberRows + 1; SA_Bounds[0].lLbound = 0; SA_Bounds[1].cElements = NumberofCols; SA_Bounds[1].lLbound = 0; //Create array resultp = SafeArrayCreate(VT_VARIANT, 2, SA_Bounds); // Start Place column headers in first row for (intCurrentColumn=0;intCurrentColumn< (ULONG)NumberofCols ;intCurrentColumn++) { long indices[] = {0,intCurrentColumn}; VariantInit(&tmpVariant); // Start Convert to unicode WideCharacterLength=strlen(SQL_Results[intCurrentColumn]) + 1 ; *TempWideDataHolder = (LPOLESTR) CoTaskMemAlloc(WideCharacterLength*2); MultiByteToWideChar( CP_ACP, 0, SQL_Results[intCurrentColumn], strlen(SQL_Results[intCurrentColumn])+1, *TempWideDataHolder, WideCharacterLength ); //Convert the VT_Object element to the BSTR - Here we may change if SQLite type casts tmpVariant.bstrVal=SysAllocString(*TempWideDataHolder); V_VT(&tmpVariant) = VT_BSTR; CoTaskMemFree(*TempWideDataHolder); // End convert to unicode // Safearray Column headers hr = SafeArrayPutElement(resultp, indices, &tmpVariant); SysFreeString(tmpVariant.bstrVal); VariantClear(&tmpVariant); } // End Place column headers in first row // Start Loop through array and fill SAFEARRAY for (intCurrentRow=1;intCurrentRow<=(ULONG)NumberRows ;intCurrentRow++) { for (intCurrentColumn=0;intCurrentColumn< (ULONG)NumberofCols ;intCurrentColumn++) { long indices[] = {intCurrentRow , intCurrentColumn}; // set return array index VariantInit(&tmpVariant); sqlite_return_array_int= (intCurrentRow * (ULONG)NumberofCols) + intCurrentColumn ; // Start Convert to unicode if (SQL_Results[sqlite_return_array_int]) { WideCharacterLength=strlen(SQL_Results[sqlite_return_array_int]) + 1 ; *TempWideDataHolder= (LPOLESTR) CoTaskMemAlloc(WideCharacterLength*2); MultiByteToWideChar( CP_ACP, 0, SQL_Results[sqlite_return_array_int], strlen(SQL_Results[sqlite_return_array_int])+1, *TempWideDataHolder, WideCharacterLength ); //Convert the VT_Object element to the BSTR - //Here we may change if SQLite type casts tmpVariant.bstrVal=SysAllocString(*TempWideDataHolder); V_VT(&tmpVariant) = VT_BSTR; CoTaskMemFree(*TempWideDataHolder); // End convert to unicode hr = SafeArrayPutElement(resultp, indices, &tmpVariant); SysFreeString(tmpVariant.bstrVal); VariantClear(&tmpVariant); } } } // END Loop through array and fill SAFEARRAY } } else { *ErrMsg = SysAllocStringByteLen( ErrMessage,strlen( ErrMessage) ); } Now I will have to figure out how to re-code this. RBS -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 06 March 2007 21:22 To: sqlite-users@sqlite.org Subject: Re: [sqlite] What is wrong with this simple query (offset)? "RB Smissaert" <[EMAIL PROTECTED]> wrote: > Ah, thanks. > I am not using the sqlite3 command line utility, but a VB adapted version of > the regular sqlite3.dll. I take it should be no problem to do the same with > that. Is there a pragma for this? > No. The returning of field names is going to be a function of your VB interface layer. The SQLite core does not do this unless requested - which means that your VB interface is requesting it. So turning of the field names is going to be some sort of call into your VB interface, not into the SQLite core. -- D. Richard Hipp <[EMAIL PROTECTED]> --
RE: [sqlite] What is wrong with this simple query (offset)?
Could I ask if somebody could tell me how I add an optional Boolean argument to this: SAFEARRAY * __stdcall sqlite_get_table( sqlite3 *db, /* The database on which the SQL executes */ const char *zSql, /* The SQL to be executed */ BSTR *ErrMsg /* Write error messages here */ ) /* Return the SAFEARRAY */ I had a go, but I know nil about C and it isn't that simple. Once I have the Boolean argument (variable) I probably manage to do the if To either put the fields in the array or leave them out. RBS -Original Message- From: RB Smissaert [mailto:[EMAIL PROTECTED] Sent: 06 March 2007 21:45 To: sqlite-users@sqlite.org Subject: RE: [sqlite] What is wrong with this simple query (offset)? Yes, I can see now where this happens: TempWideDataHolder = CoTaskMemAlloc(1); // Set up array bounds SA_Bounds[0].cElements = NumberRows + 1; SA_Bounds[0].lLbound = 0; SA_Bounds[1].cElements = NumberofCols; SA_Bounds[1].lLbound = 0; //Create array resultp = SafeArrayCreate(VT_VARIANT, 2, SA_Bounds); // Start Place column headers in first row for (intCurrentColumn=0;intCurrentColumn< (ULONG)NumberofCols ;intCurrentColumn++) { long indices[] = {0,intCurrentColumn}; VariantInit(&tmpVariant); // Start Convert to unicode WideCharacterLength=strlen(SQL_Results[intCurrentColumn]) + 1 ; *TempWideDataHolder = (LPOLESTR) CoTaskMemAlloc(WideCharacterLength*2); MultiByteToWideChar( CP_ACP, 0, SQL_Results[intCurrentColumn], strlen(SQL_Results[intCurrentColumn])+1, *TempWideDataHolder, WideCharacterLength ); //Convert the VT_Object element to the BSTR - Here we may change if SQLite type casts tmpVariant.bstrVal=SysAllocString(*TempWideDataHolder); V_VT(&tmpVariant) = VT_BSTR; CoTaskMemFree(*TempWideDataHolder); // End convert to unicode // Safearray Column headers hr = SafeArrayPutElement(resultp, indices, &tmpVariant); SysFreeString(tmpVariant.bstrVal); VariantClear(&tmpVariant); } // End Place column headers in first row // Start Loop through array and fill SAFEARRAY for (intCurrentRow=1;intCurrentRow<=(ULONG)NumberRows ;intCurrentRow++) { for (intCurrentColumn=0;intCurrentColumn< (ULONG)NumberofCols ;intCurrentColumn++) { long indices[] = {intCurrentRow , intCurrentColumn}; // set return array index VariantInit(&tmpVariant); sqlite_return_array_int= (intCurrentRow * (ULONG)NumberofCols) + intCurrentColumn ; // Start Convert to unicode if (SQL_Results[sqlite_return_array_int]) { WideCharacterLength=strlen(SQL_Results[sqlite_return_array_int]) + 1 ; *TempWideDataHolder= (LPOLESTR) CoTaskMemAlloc(WideCharacterLength*2); MultiByteToWideChar( CP_ACP, 0, SQL_Results[sqlite_return_array_int], strlen(SQL_Results[sqlite_return_array_int])+1, *TempWideDataHolder, WideCharacterLength ); //Convert the VT_Object element to the BSTR - //Here we may change if SQLite type casts tmpVariant.bstrVal=SysAllocString(*TempWideDataHolder); V_VT(&tmpVariant) = VT_BSTR; CoTaskMemFree(*TempWideDataHolder); // End convert to unicode hr = SafeArrayPutElement(resultp, indices, &tmpVariant); SysFreeString(tmpVariant.bstrVal); VariantClear(&tmpVariant); } } } // END Loop through array and fill SAFEARRAY } } else { *ErrMsg = SysAllocStringByteLen( ErrMessage,strlen( ErrMessage) ); } Now I will have to figure out how to re-code this. RBS -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 06 March 2007 21:22 To: sqlite-users@sqlite.org Subject: Re: [sqlite] What is wrong with this simple query (offset)? "RB Smissaert" <[EMAIL PROTECTED]> wrote: > Ah, thanks. > I am not using the sqlite3 command line utility, but a VB adapted version of > the regular sqlite3.dll. I take it should be no problem to do the same with > that. Is there a pragma for this? > No. The returning of field names is going to be a function of your VB interface layer. The SQLite core does not do this unless requested - which means that your VB interface is requesting it. So turning of the field names is going to be some sort of call into your VB interface, not into the SQLite core. -- D. Richard Hipp <[EMAIL PROTECTED]> - To unsubscribe, send email to [EMAIL PROTECTED] - --
RE: [sqlite] What is wrong with this simple query (offset)?
Yes, I can see now where this happens: TempWideDataHolder = CoTaskMemAlloc(1); // Set up array bounds SA_Bounds[0].cElements = NumberRows + 1; SA_Bounds[0].lLbound = 0; SA_Bounds[1].cElements = NumberofCols; SA_Bounds[1].lLbound = 0; //Create array resultp = SafeArrayCreate(VT_VARIANT, 2, SA_Bounds); // Start Place column headers in first row for (intCurrentColumn=0;intCurrentColumn< (ULONG)NumberofCols ;intCurrentColumn++) { long indices[] = {0,intCurrentColumn}; VariantInit(&tmpVariant); // Start Convert to unicode WideCharacterLength=strlen(SQL_Results[intCurrentColumn]) + 1 ; *TempWideDataHolder = (LPOLESTR) CoTaskMemAlloc(WideCharacterLength*2); MultiByteToWideChar( CP_ACP, 0, SQL_Results[intCurrentColumn], strlen(SQL_Results[intCurrentColumn])+1, *TempWideDataHolder, WideCharacterLength ); //Convert the VT_Object element to the BSTR - Here we may change if SQLite type casts tmpVariant.bstrVal=SysAllocString(*TempWideDataHolder); V_VT(&tmpVariant) = VT_BSTR; CoTaskMemFree(*TempWideDataHolder); // End convert to unicode // Safearray Column headers hr = SafeArrayPutElement(resultp, indices, &tmpVariant); SysFreeString(tmpVariant.bstrVal); VariantClear(&tmpVariant); } // End Place column headers in first row // Start Loop through array and fill SAFEARRAY for (intCurrentRow=1;intCurrentRow<=(ULONG)NumberRows ;intCurrentRow++) { for (intCurrentColumn=0;intCurrentColumn< (ULONG)NumberofCols ;intCurrentColumn++) { long indices[] = {intCurrentRow , intCurrentColumn}; // set return array index VariantInit(&tmpVariant); sqlite_return_array_int= (intCurrentRow * (ULONG)NumberofCols) + intCurrentColumn ; // Start Convert to unicode if (SQL_Results[sqlite_return_array_int]) { WideCharacterLength=strlen(SQL_Results[sqlite_return_array_int]) + 1 ; *TempWideDataHolder= (LPOLESTR) CoTaskMemAlloc(WideCharacterLength*2); MultiByteToWideChar( CP_ACP, 0, SQL_Results[sqlite_return_array_int], strlen(SQL_Results[sqlite_return_array_int])+1, *TempWideDataHolder, WideCharacterLength ); //Convert the VT_Object element to the BSTR - //Here we may change if SQLite type casts tmpVariant.bstrVal=SysAllocString(*TempWideDataHolder); V_VT(&tmpVariant) = VT_BSTR; CoTaskMemFree(*TempWideDataHolder); // End convert to unicode hr = SafeArrayPutElement(resultp, indices, &tmpVariant); SysFreeString(tmpVariant.bstrVal); VariantClear(&tmpVariant); } } } // END Loop through array and fill SAFEARRAY } } else { *ErrMsg = SysAllocStringByteLen( ErrMessage,strlen( ErrMessage) ); } Now I will have to figure out how to re-code this. RBS -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 06 March 2007 21:22 To: sqlite-users@sqlite.org Subject: Re: [sqlite] What is wrong with this simple query (offset)? "RB Smissaert" <[EMAIL PROTECTED]> wrote: > Ah, thanks. > I am not using the sqlite3 command line utility, but a VB adapted version of > the regular sqlite3.dll. I take it should be no problem to do the same with > that. Is there a pragma for this? > No. The returning of field names is going to be a function of your VB interface layer. The SQLite core does not do this unless requested - which means that your VB interface is requesting it. So turning of the field names is going to be some sort of call into your VB interface, not into the SQLite core. -- D. Richard Hipp <[EMAIL PROTECTED]> - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
RE: [sqlite] What is wrong with this simple query (offset)?
OK, thanks. Will have a look now in the code where the field names are added to the array and will see if I can re-code this to make it optional. RBS -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 06 March 2007 21:22 To: sqlite-users@sqlite.org Subject: Re: [sqlite] What is wrong with this simple query (offset)? "RB Smissaert" <[EMAIL PROTECTED]> wrote: > Ah, thanks. > I am not using the sqlite3 command line utility, but a VB adapted version of > the regular sqlite3.dll. I take it should be no problem to do the same with > that. Is there a pragma for this? > No. The returning of field names is going to be a function of your VB interface layer. The SQLite core does not do this unless requested - which means that your VB interface is requesting it. So turning of the field names is going to be some sort of call into your VB interface, not into the SQLite core. -- D. Richard Hipp <[EMAIL PROTECTED]> - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] What is wrong with this simple query (offset)?
"RB Smissaert" <[EMAIL PROTECTED]> wrote: > Ah, thanks. > I am not using the sqlite3 command line utility, but a VB adapted version of > the regular sqlite3.dll. I take it should be no problem to do the same with > that. Is there a pragma for this? > No. The returning of field names is going to be a function of your VB interface layer. The SQLite core does not do this unless requested - which means that your VB interface is requesting it. So turning of the field names is going to be some sort of call into your VB interface, not into the SQLite core. -- D. Richard Hipp <[EMAIL PROTECTED]> - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] What is wrong with this simple query (offset)?
- Original Message - From: "RB Smissaert" <[EMAIL PROTECTED]> To: Sent: Tuesday, March 06, 2007 1:39 PM Subject: [sqlite] What is wrong with this simple query (offset)? Why does this query give a syntax error near offset? SELECT Name FROM SQLITE_MASTER WHERE TYPE = 'table' ORDER BY 1 ASC offset 2 limit works fine. Though I've never used OFFSET, the documentation seems to state that OFFSET is an *optional* component of the LIMIT clause. So, I'd guess you can't use it without also using LIMIT. Jeff - To unsubscribe, send email to [EMAIL PROTECTED] -
RE: [sqlite] What is wrong with this simple query (offset)?
I can see now that doing SELECT name FROM SQLITE_MASTER WHERE TYPE = 'table' ORDER BY 1 ASC limit -1 offset 2 works, but it doesn't do what I was trying and that is to keep the field name out. RBS -Original Message- From: RB Smissaert [mailto:[EMAIL PROTECTED] Sent: 06 March 2007 19:40 To: sqlite-users@sqlite.org Subject: [sqlite] What is wrong with this simple query (offset)? Why does this query give a syntax error near offset? SELECT Name FROM SQLITE_MASTER WHERE TYPE = 'table' ORDER BY 1 ASC offset 2 limit works fine. RBS - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -