Storing and retrieving data from a SQL database
Paul Dupuis
paul at researchware.com
Fri May 20 21:33:02 EDT 2016
Apparently, you either DO need to escape certain characters even when
using parametrized queries.
I have the code below: I pass it an array where the description
pArray[7] contains several lines of text from a field and the second
line contains a tab
command updateInDatabase pArray
--
pArray[1]=ID,[2]=Name,[3]=Type,[4]=Topic,[5]=Subtopic,[6]=Duration,[7]=Description,[8]=Source
put the databaseID of this stack into tDatabaseID
put "UPDATE mytable SET
name=:2,type=:3,topic=:4,subtopic=:5,duration=:6,description=:7,source=:8 WHERE
id=:1" into tQuery
revExecuteSQL tDatabaseID,tQuery,"pArray"
get the result
if it is not a number then
-- error
put it
else
-- number of rows changed
end if
end updateInDatabase
This executes and indicates a row was update in the database and a
direct check of the SQLite database shows that columns were updated
EXCEPT for description where any content that was in pArray[7] AFTER and
including the TAB is missing. So apparently TABs can not be included in
data passed by parameters.
OR is this a LiveCode 8 bug?
More information about the use-livecode
mailing list