Keep in mind, I am migrating this program code from Realbasic to Lc, so this is the first time I'm poking about db's in Lc. The code is neither pretty nor even very nice at this point in my learning.
The error returned when the statement is formatted like your example, whether spaces or no after the commas is 'revdberr,Database Error: near ",": syntax error'
Code: Select all
// code inside button loading the db into a datagrid named 'lstRecords'...
local tmpConnId, tmpSql, tmpRecs
if field "connID" is empty then put revOpenDatabase ("sqlite", "collections.rsd", , , , ) into field "connID"
// this is only so I can see the connection id at this point...
put field "connID" into tmpConnId
// the statement commented here works, but not if I add (Cast)...
// put "SELECT (Title),(Year),(Format),(Summary) FROM Movies" into tmpSql
/* this statement returns [revdberr,Database Error: near ",": syntax error]
whether there are spaces or not ... */
put "SELECT Title, Year, Format, Cast, Summary FROM Movies" into tmpSql
// from here to the end appears to work...
put revDataFromQuery(tab,return,tmpConnId,tmpSql) into tmpRecs
sort tmpRecs ascending
put "Title" & cr & "Year" & cr & "Format" & cr & "Cast" & cr & "Summary" & cr & "catNumber" into tmpCols
set the dgProp["columns"] of group "lstRecords" to tmpCols
set the dgText of group "lstRecords" to tmpRecs
Edit* In case your wondering what the values are, I created it in RB with this statement -
Code: Select all
CREATE TABLE Movies (Title string, Year String, Format String, Cast String, Summary String, Cover Binary, catNumber Integer PRIMARY KEY)
I know (or think I know) when I go to retrieve the covers (pictures), that will require 2 statements, using revQueryDatabase and revDatabaseColumnNamed since it is a blob.