Mysql UNIQUE and .lc server scripts?

Mike Bonner bonnmike at gmail.com
Fri May 9 15:45:43 EDT 2014


You're already sending back the sql string you use for the insert to your
client (put tSql) should be an easy thing to add an if statement right
after your revexecutesql.

if the result is not an integer then put cr & "ERROR:"  && the result

Then check the data you got back and see if it contains ERROR: and show it
to the user if there was. So yeah, as you surmised you can just put the
result, then handle it however you wish on the client side.




On Fri, May 9, 2014 at 1:37 PM, Simon Smith <hello at simonsmith.co> wrote:

> Hi John
>
> I would first run a search on the table to see if the value exists, if it
> does not exist, then you can run the insert statement. If the value does
> exist, you can then have some sort of error procedure.
>
> Kind Regards
> Simon
>
>
> On Fri, May 9, 2014 at 1:18 AM, 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:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
>
>
>
> --
>
> *Simon Smith*
> *seo, online marketing, web development*
>
> w. http://www.simonsmith.co
> m. +27 83 306 7862
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the Use-livecode mailing list