|
Post by carlgundel on Aug 26, 2008 14:08:42 GMT -5
I have just added an enhancement to SQLite database access. Now you can ask for the next row as an object, and then it will dynamically generate methods named after its column names and add them to the row object returned.
Given a table with the following column names: ID, NAME, EMAIL, SECONDS
The following code would apply:#dbase execute("select * from MYTABLE") #row = #dbase #nextrow() print "ID = "; #row ID(); " NAME = "; #row NAME$(); " EMAIL = "; #row EMAIL$(); " SECONDS = "; #row SECONDS() I hope this will prove to be a helpful improvement to the database accessor object.
If you're going to join two or more tables and they share some column names, you should alias the column names (actually I haven't tested that yet, but I intend to support it).
-Carl
|
|
|
Post by carlgundel on Aug 26, 2008 15:41:52 GMT -5
Okay, I've tested this now using the SQL keyword AS to alias column names. It does work. I think it would be great if SQLite would return fully qualified column names (ie. TABLE.COL) automatically, but perhaps there is something I don't yet know about how to do this.
-Carl
|
|
|
Post by kokenge on Aug 26, 2008 17:42:28 GMT -5
Thank you Carl. This will save me tons of development time. Especially in projects with multiple tables and complex sql statements. I was recently ask to look at some PeopleSoft stuff and they have over 3500 tables. It will save so much time in my projects that I'm placing my projects on hold until it becomes available. When will it become available for download???
|
|
neal
Full Member
Posts: 104
|
Post by neal on Aug 28, 2008 7:52:02 GMT -5
Thanks Carl - that looks like a nice solution to the problem!
|
|