SQLite Issue

Chipp Walters chipp at chipp.com
Tue Dec 27 04:04:45 EST 2005


Hi Scott,

Looks like you're double referencing the same variable in your first 
repeat loop. You shouldn't ever set the 'for each' var during the loop 
and you are doing it by:

put Field "edName" into i

try

put Field "edName" into j
and don't forget to cleanSQL(j) as well.

best,

Chipp


> on mouseUp
>   global gConID
>   
>   --> COLLECT name AND email
>   put "name,email" into tColumnItems
>   repeat for each item I in tColumnItems
>     --ask question "New value for column: " & I
>     put Field "edName" into i
>     --if it is empty or the result is "cancel" then exit to top
>     put "'" & cleanSQL(it) & "'" & "," after tRowData
>   end repeat
>   
>   --> COLLECT emailList
>   ask question "New value for column: emailList" with "true"
>   if it is empty or the result is "cancel" then exit to top
>   put "'" & cleanSQL(it) & "'" after tRowData
>   
>   --> CONSTRUCT SQL
>   put "INSERT INTO users(userID,name,email,emailList)" & \
>   " VALUES(null," & tRowData & ")" into tSQL
>   --> EXECUTE SQL
>   put revdb_execute(gConID,tSQL) into tTmp
> 
>   handleRevDBerror tTmp
>   if the result is not empty then 
>     answer warning the result
>     exit mouseUp
>   end if
>   answer information "Number of rows added: " &cr& tTmp
> end mouseUp
> 
> function cleanSQL pSQL
>   --> THIS ESCAPES THE QUOTE PROBLEM IN SQL
>   replace "'" with "''" in pSQL
>   replace quote with quote & quote in pSQL
>   --> THIS ESCAPES THE tab AND cr DELIMITERS
>   --> IF YOU PLAN ON HAVING USERS ENTER cr AND tab THEN YOU ALSO NEED TO
>   -->    replace "*CR*" with cr IN THE RETURNED DATA!
>   replace cr with "*CR*" in pSQL
>   replace tab with "*TAB*" in pSQL
>   return pSQL
> end cleanSQL
> 
> ----------  End Paste --------------
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> 




More information about the use-livecode mailing list