Since you know how many columns are in the result set, can't you just
ignore the first row when referencing your data?  It seems to me at that
point you won't have any significant performance penalties.

Eric Pankoke
Founder
Point Of Light Software
http://www.polsoftware.com/
 

-----Original Message-----
From: RB Smissaert [mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 27, 2007 11:22 AM
To: sqlite-users@sqlite.org
Subject: RE: [sqlite] return table data without fields

Thanks for that information.
Taking the first row out of the array will have a big performance
penalty as
you say as you will have to write a whole new array. I know near enough
nil
about C, so altering the source will be difficult. Will think of
something.

Didn't know about the NULL handling and that is worth knowing and will
see
if it affects my app in some way.

RBS


-----Original Message-----
From: Trey Mack [mailto:[EMAIL PROTECTED] 
Sent: 27 January 2007 15:57
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] return table data without fields

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]
------------------------------------------------------------------------
----
-




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




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

Reply via email to