Re: [sqlite] outputting select in cpp file?

2006-07-29 Thread Clay Dowling
Clay Dowling wrote:

> 1. Use the sqlite3 interface, not sqlite 2.
> 
> 2. Store a 0 or a 1 in the field.  Then you can get the value with
> sqlite3_column_int
> 
> There's a more complicated answer as well, but I wasn't able to get the
> code assembled before it was time to turn in last night.
> 
> Clay Dowling

My proposed "more complicated answer" can be downloaded from
http://www.lazarusid.com/download/dbconfig.zip

It's shockingly complete, with documentation and unit testing even.  If
my boss ever finds out that I'm doing stuff like that there's gonna be
trouble

Clay
-- 
CeaMuS
http://www.ceamus.com
Simple Content Management


Re: [sqlite] outputting select in cpp file?

2006-07-29 Thread Clay Dowling
Keiichi McGuire wrote:
> This sounds like a very simple problem, but I cannot figure it out!
> 
> Basically what I have is this settings table that has a boolean data
> type, and I want to check it via a cpp program.
> 
> sqlite_exec(db,"select flag from setting",0,0,);
> 
> and I want to be able to return a 0, or a 1 according to what I put into
> the flag entry.

1. Use the sqlite3 interface, not sqlite 2.

2. Store a 0 or a 1 in the field.  Then you can get the value with
sqlite3_column_int

There's a more complicated answer as well, but I wasn't able to get the
code assembled before it was time to turn in last night.

Clay Dowling
-- 
CeaMuS
http://www.ceamus.com
Simple Content Management


RE: [sqlite] outputting select in cpp file?

2006-07-28 Thread Pat Wibbeler
Check out the callback parameter to sqlite_exec (the third parameter).
The quickstart gives an example of this:

http://www.sqlite.org/quickstart.html

Alternatively, check out sqlite3_prepare, sqlite3_bind, and
sqlite3_step, sqlite3_result*, and sqlite3_finalize.

All of these functions are documented here:
http://www.sqlite.org/capi3ref.html

Pat


-Original Message-
From: Keiichi McGuire [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 28, 2006 3:36 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] outputting select in cpp file?

This sounds like a very simple problem, but I cannot figure it out!

Basically what I have is this settings table that has a boolean data
type, and I want to check it via a cpp program.

sqlite_exec(db,"select flag from setting",0,0,);

and I want to be able to return a 0, or a 1 according to what I put into
the flag entry.

Thanks!
-Keiichi