Re: [sqlite] number of columns in a table

2009-02-18 Thread Martin Engelschalk
Hi,

see http://www.sqlite.org/capi3ref.html#sqlite3_column_count.

Do this:

sqlite3_stmt *pStmnt;
sqlite3_prepare(YourDbHandle, "select * from YourTable limit 1", -1, 
, 0);
int NumberOfColumns = sqlite3_column_count(pStmnt);
sqlite3_finalize(pStmnt)

Martin

baxy77bax wrote:
> hi,
>
> my question is how to get the number of columns in an existing table.
> example if i can retrieve the number of rows with SELECT count(*) FROM table
> , is there also some simple query to do the same thing for counting the
> number of columns
>
> thnx
>
> r
>
>   

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] number of columns in a table

2009-02-18 Thread Griggs, Donald

hi,

my question is how to get the number of columns in an existing table.
example if i can retrieve the number of rows with SELECT count(*) FROM
table , is there also some simple query to do the same thing for
counting the number of columns


==

Hello, "r"

You can use sql to query the system table named:  sqlite_master
Also see
   http://www.sqlite.org/pragma.html#schema

Donald
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] number of columns in a table

2009-02-18 Thread baxy77bax

hi,

my question is how to get the number of columns in an existing table.
example if i can retrieve the number of rows with SELECT count(*) FROM table
, is there also some simple query to do the same thing for counting the
number of columns

thnx

r

-- 
View this message in context: 
http://www.nabble.com/number-of-columns-in-a-table-tp22086144p22086144.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users