I cannot find a PRAGMA for turning column names on/off either. You may be thinking of ".headers on/off" in the SQLite shell..

I don't think there's a way to turn this off, except rewriting the code for sqlite_get_table (which, thankfully, he's provided). Maybe to include a 4th parameter that would be a flag to include column headers or not.

Or you could wrap all your calls through a VB function of your design that strips that first row (the column headers) out of the array, but I'd worry about performance with that method.

One thing worth mentioning about this wrapper is that it doens't handle NULL return values as you might expect. If you issue a query that should return NULL.. like:

   create table t (a integer); -- no records..
   select max(a) from t; -- should return NULL, since there is no max
   select typeof(max(a)) from t; -- proves that SQLite returns NULL

you'll receive "" (the empty string) in the spot in the array where your result ends up.

But again, thankfully, he's provided the source, so you can add the following lines

else { // I hope the following is safe, as I'm definitely NOT a C/C++ guru.. especially with memory allocation / deallocation
       tmpVariant.vt = VT_NULL;
       hr = SafeArrayPutElement(resultp, indices, &tmpVariant);
       VariantClear(&tmpVariant);
   }

at line 103 in my copy of VBSQL.c (I may have done some formatting, I forget), as the else for the following if:

   if (SQL_Results[sqlite_return_array_int]) {

then, the Variant that will be sent to VB6 will be of type Null and can be tested with the VB6 function IsNull(..) properly.

Regards,
   Trey

----- Original Message ----- From: "RB Smissaert" <[EMAIL PROTECTED]>
To: <sqlite-users@sqlite.org>
Sent: Saturday, January 27, 2007 7:01 AM
Subject: [sqlite] return table data without fields


Using the VB wrapper dll from Todd Tanner:
http://www.tannertech.net/sqlite3vb/index.htm

and it has this function to return table rows:

Private Declare Function sqlite_get_table _
                         Lib "SQLite3VB.dll" _
                             (ByVal DB_Handle As Long, _
                              ByVal SQLString As String, _
                              ByRef ErrStr As String) As Variant()

This will by default include the table field names.
Is there a way to return the table data without these field names?
I thought there was a Pragma command for this, but I couldn't find it.

RBS



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




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

Reply via email to