SQL does not evaluate variables
Posted: Tue Feb 24, 2015 8:20 pm
I have the following problem. Can anybody advice me?
I need to create and maintain sqlite databases for my applications. Creating the DB and the tables goes just fine.
The following line of code does what it should:
put "INSERT into sticky_table VALUES (1235,1235,'200,456',90,70,'120,90,30','green','this is a message');" after tSQL
but the one below does nothing:
put "INSERT into sticky_table VALUES (1234,gShortID,'123,456',90,70,'yellow','black','this is a message');" into tSQL
that is, if I have variable names in the insert statement, they don't get evaluated, even though the variables have
values; that I have verified with the message box.
What am I missing?
The total environment for the insert looks like this:
on databaseInsertSticky
## Insert names and email addresses into the database
local tDatabaseID,tSQL
put getDatabaseID() into tDatabaseID
show message box
put gShortID into message
put "INSERT into sticky_table VALUES (1234,gShortID,'123,456',90,70,'yellow','black','Lorem ipsum');" into tSQL
revExecuteSQL tDatabaseID, tSQL
end databaseInsertSticky
which, as I indicated, works fine for specific constant values, but not for variables.
I need to create and maintain sqlite databases for my applications. Creating the DB and the tables goes just fine.
The following line of code does what it should:
put "INSERT into sticky_table VALUES (1235,1235,'200,456',90,70,'120,90,30','green','this is a message');" after tSQL
but the one below does nothing:
put "INSERT into sticky_table VALUES (1234,gShortID,'123,456',90,70,'yellow','black','this is a message');" into tSQL
that is, if I have variable names in the insert statement, they don't get evaluated, even though the variables have
values; that I have verified with the message box.
What am I missing?
The total environment for the insert looks like this:
on databaseInsertSticky
## Insert names and email addresses into the database
local tDatabaseID,tSQL
put getDatabaseID() into tDatabaseID
show message box
put gShortID into message
put "INSERT into sticky_table VALUES (1234,gShortID,'123,456',90,70,'yellow','black','Lorem ipsum');" into tSQL
revExecuteSQL tDatabaseID, tSQL
end databaseInsertSticky
which, as I indicated, works fine for specific constant values, but not for variables.