Page 1 of 1

some string functions in Select statement throw an error

Posted: Thu Jun 23, 2022 4:16 pm
by djkesler
Using LC in CGI mode on the server I am seeing errors being generated when I include either of the following string functions:
Like
In
example - Select * from plants where marketid like '%1%'
example - Select * from plants where planttype in ('peppers','herbs','tomatoes')

I have not problem using these functions from the IDE and standalone app, but from the server itself, I cannot get it to work.

this is the snippet in my livecode.lc file that I use to access the database on my on-rev account.
put urlDecode(tSQL) into tSQL
put revdataFromQuery(titemdel,tlinedel,gConID,tSQL) into tRecords
put URLEncode(tRecords)

thanks for any help.

Re: some string functions in Select statement throw an error

Posted: Thu Jun 23, 2022 5:15 pm
by Klaus
What exactly does not work? No data returned? Error messages?

Does it work if you leave out the URLEN-/DECODE stuff for testing?

Re: some string functions in Select statement throw an error

Posted: Fri Jun 24, 2022 2:37 pm
by djkesler
Thanks for your reply. I have been using LC since '11 and have alway just done a direct connect to the database. Obviously, deploying on the HTML5, I'm having to learn some new tricks. But since I "abstracted" every database call I have been able to use almost all of the code written in this application. It's just getting the niggly bits worked out. I have been pretty amazed how well the web build has gone.

it seems that it works differently depending on whether I include the "internet" library when building a standalone file. I had noticed that the web standalone file has "internet" support, but if you include "internet" in the build it will use that library instead.

If I don't include "internet" I am returned no records.

If I do include "internet" I am returned the revdberr something like, Check for the correct syntax, error found in line 1 near, 'like ("%1&') ...

I have rewritten the routine that uses the "like" by getting all the records and doing a match for the correct information before passing it back to the calling routine.

The "IN" function is going to be a little harder to manage. I haven't worked out the "internet" inclusion on the "IN" function.

I am trying to sus out on what conditions the LC 10.0.0 dp4 and the latest 9.6.8 rc fail to save and corrupt the file. I am getting this VERY often and it is really slowing down my efforts to learn how to deploy on the Web. The saving issue doesn't seem to be related to using Rosetta or not.