bundling multiple database queries and getting a result
Mike Bonner
bonnmike at gmail.com
Sun Jun 2 08:43:35 EDT 2013
Just tried it on one of my databases with revdatafrom query. Did this in
the message box:
put "BEGIN TRANSACTION;" into tSql -- transaction start. Add semicolon.
put cr & "select * from clientinfo where applicantname like 'Garcia%';"
after tSql -- next line, add semicolon
put cr & "select * from reminders where clientid is 5699;" after tSql --
next line, add semicolon
put cr & "COMMIT" after tSql -- last line, no semicolon
get revdatafromquery(,,1,tSql)
put it
I've only tested this on sqlite. No clue if it works with other dbms.
These are 2 completely unrelated queries that appear 1 after the other
consecutively, from 2 different tables
If you need to do joins instead you can use dot notation for your
selections across tables. "select tablename.fieldname,
tablename2.fieldname where ..."
On Sun, Jun 2, 2013 at 4:56 AM, Björnke von Gierke <bvg at mac.com> wrote:
> You can't do multi line sql with livecode, you have to issue them
> separately. So for example in SQLite this works to reduce latency:
>
> revexecuteSQL theConnID, "BEGIN TRANSACTION"
> repeat 20 times
> revexecuteSQL theConnID, "INSERT INTO table (column) VALUES 'blah'"
> end repeat
> revexecuteSQL theConnID, "END TRANSACTION"
>
> Dunnow if it'll help in a networked environment when doing queries tho.
>
> On 01.06.2013, at 20:45, Dr. Hawkins wrote:
>
> > My initial forays haven't been successful.
> >
> > I want to pull unrelated things, likely from different tables, from the
> > same database as part of a single inquiry
> >
> > something like
> >
> > begin transaction;
> > SELECT a, b, c FROM firsttable;
> > SELECT name,address FROM othertable WHERE ID=47;
> > commit;
> >
> > The inquiries aren't really related, but the latency in an offsite query
> > means that a series of inquiries slows down the program.
> >
> > I've tried
> >
> > BEGIN TRANSACTION;
> > SELECT val FROM baggins_bilbo____001_dinfo WHERE kywd='dFirstName';
> > SELECT val FROM baggins_bilbo____001_dinfo WHERE kywd='dLastName';
> > COMMIT;
> >
> > Which returns 0 from revExecuteSQL
> >
> > I've tried leaving off the begin/commit with revDataFromQuery, but only
> the
> > last query gets executed.
> >
> > --
> > Dr. Richard E. Hawkins, Esq.
> > (702) 508-8462
> > _______________________________________________
> > 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
>
>
> --
>
> Use an alternative Dictionary viewer:
> http://bjoernke.com/bvgdocu/
>
> Chat with other RunRev developers:
> http://bjoernke.com/chatrev/
>
>
>
> _______________________________________________
> 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