Mysql UNIQUE and .lc server scripts?
johnpatten at me.com
Fri May 9 11:48:23 EDT 2014
Thanks Peter and Mark!
I was trying to figure out how I would retrieve the result from my server lc script? Would I have to set the ErrorMode to see the mysql result? It’s not really an error, but a mySQL result.
My lc script is pretty basic. I’m just using a familiar example:
put revOpenDatabase ("mysql","jpatten.on-rev.com","jpatten_xxxxx","jpatten_xxxxxx”,"xxxxxxx") into tConID
put “NewItem" into tTablename
put "itemnumber, datecreated, uniqueid, reddescription, bluedescription, greendescription, title, textselection" into tFields
put $_GET["uniqueid"] into tuniqueid
put $_GET["reddescription"] into treddescription
put $_GET["bluedescription"] into tbluedescription
put $_GET["greendescription"] into tgreendescription
put $_GET["thetitle"] into ttitle
put $_GET["textselection"] into ttextselection
put "INSERT INTO" && tTablename && "(" & tFields & ") VALUES (:1, :2, :3, :4, :5, :6, :7, :8);" into tSQL
revExecuteSQL tConID, tSQL, "tuniqueid", "treddescription", "tbluedescription", "tgreendescription", "ttitle", "ttextselection"
I’m not sure how to send the result back to my app in order to act on it? After the revExecuteSQL, would it just be, Put the result or …? Then, on the stack that sent the original data, at the end of the sending script “answer it, or answer the result?
On May 8, 2014, at 5:21 PM, Peter Haworth <pete at lcsql.com> wrote:
> Hi John,
> What's in the result after calling revExecuteSQL to issue your INSERT
> statement? You should get either an integer count of the number of rows
> inserted or an error message.
> lcSQL Software <http://www.lcsql.com>
> Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
> SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>
> On Thu, May 8, 2014 at 4:18 PM, JOHN PATTEN <johnpatten at me.com> wrote:
>> Hi All,
>> I’m using some .lc server scripts to add records to a database from an
>> app. My database has one field that is UNIQUE. Is it possible to capture
>> the mySQL message and report it back to the app when text entered for
>> specific field is not unique?
>> The database won’t create the record due to the fact that the filed is not
>> unique, but it also does not give the user any clue of this fact.
>> Thank you!
>> John Patten
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the Use-livecode