revDatabaseColumnNames and AltSqlite3

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
rolandw
Posts: 11
Joined: Tue Oct 24, 2006 8:47 am

revDatabaseColumnNames and AltSqlite3

Post by rolandw » Wed Mar 28, 2007 2:07 pm

Has anyone succeeded in getting this function to work? At the moment following:

Code: Select all

put revQueryDatabase(dbID,theQuery) into tCursor
the following work:

Code: Select all

put revNumberOfRecords(tCursor) into tRecordCount
put revDatabaseColumnCount(tCursor) into tColumnCount
but:

Code: Select all

put revDatabaseColumnNames(tCursor) in tColumns
returns an error "Handler:can't find handler"

I'm trying to identify the names of the columns being returned and of course, this command is vital.

Anyone else got any bright ideas for obtaining the correct column names regardless of what someone puts in as a query from AltSqlite3?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Wed Mar 28, 2007 3:46 pm

Hi Roland,

Apparently, something went wrong when the Rev engine was compiled and the revDatabaseColumnnames function was not included.

You can use revdb_columnnames instead.

Best regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

rolandw
Posts: 11
Joined: Tue Oct 24, 2006 8:47 am

Post by rolandw » Wed Mar 28, 2007 4:23 pm

Hi Mark,

Thanks for that but I think that revdb_columnnames got missed at compile as well! I get the same error!


Roland

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Wed Mar 28, 2007 4:57 pm

Hi Roland,

Here it works, but if you can't get it to work, use the SQL command DESCRIBE:

put revDataFromQuery(tab,return,theID,"describe" && theTabe & ";") into myColumns


theID is a number and theTable is a table name. You might want to check a SQL manual for DESCRIBE.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

rolandw
Posts: 11
Joined: Tue Oct 24, 2006 8:47 am

Post by rolandw » Wed Mar 28, 2007 5:31 pm

Hi Mark,

Thanks again but that's the wrong answer in this issue. "Describe Table XXX" would privde a full description of table XXX regardless of the query. What I am trying to get is the names of the columns in the current cursor as a result of a select statement. OK, I should know this (because I wrote the select statement) but I am assuming that my user has written the statement, that I don't know what it is but that I need it in order to parse the rows returned.

Equally unfortunately SQLite doesn't support "Describe".

There is a way to get SQLite to return the column names by running a different execute call but unless I wan't to recompile the rev db engine to get it to work, I don't think that this is going to happen...

Roland

Post Reply

Return to “Databases”