Ok thanks for responding...

That was my understanding but I was wondering why it only returned 1 Row in
*pnRow. I've figured it out now (I think). The first row contains the column
name but does not count as a result. Hence the 1 row that is referred to in
*pnRow returned from sqlite3_get_table() is the single result I'm after.

Lo and behold, when I check the 2nd string referenced by the result pointer,
I get what I'm after!

Many thanks!
Richard.

-----Original Message-----
From: Dennis Cote [mailto:[EMAIL PROTECTED] 
Sent: 03 March 2005 19:31
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] correct use of sqlite3_get_table

Richard Boyd wrote:

> Hi all,
>
> I’m trying to use sqlite3_get_table() to execute SQL commands on a 
> database. I’ve included a code snippet below.
>
> The problem I’m having is that when I execute the "SELECT 
> MAX(time_stamp) FROM table32;” command using sqlite3_get_table() I 
> only get one column and 1 row returned and the result contains 
> “MAX(time_stamp)” rather than the value I’m after. When I run the same 
> command in sqlite3.exe shell I get the desired result (a single number).
>
> Any one any ideas where I’m going wrong with this??
>
Richard,

You need to read the documentation for the sqlite3_get_table() function 
at http://www.sqlite.org/capi3ref.html#sqlite3_get_table. It explains 
how the column header information is returned along with the actual 
data. You are looking at the heading for your column, the data is 
further into the results array.

HTH
Dennis Cote


-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.5.2 - Release Date: 28/02/2005




--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.5.2 - Release Date: 28/02/2005

Reply via email to