Execute multiple MySQL commands

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Execute multiple MySQL commands

Mark Wieder via use-livecode
Hello,

I’ve an « syntax error » as result if i want to execute multiple MySQL commands, even with transactions.

It is normal ? If i execute one command at time, it’s work.

Thanks !



Here a sample script :

revExecuteSQL tDatabaseID,"BEGIN TRANSACTION »

put "INSERT INTO savemyTable (column1) VALUES (1)  & ";" & cr into tSQL

put "DELETE FROM myTable WHERE id = " & id & ";" & cr after tSQL

revExecuteSQL tDatabaseID, tSQL

if the result is not an integer then answer the result

else …// COMMIT



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Execute multiple MySQL commands

Mark Wieder via use-livecode
I thought I read somewhere that the LC API does not support multiple statements?

Bob S


> On Feb 8, 2018, at 02:24 , Ludovic THEBAULT via use-livecode <[hidden email]> wrote:
>
> Hello,
>
> I’ve an « syntax error » as result if i want to execute multiple MySQL commands, even with transactions.
>
> It is normal ? If i execute one command at time, it’s work.
>
> Thanks !
>
>
>
> Here a sample script :
>
> revExecuteSQL tDatabaseID,"BEGIN TRANSACTION »
>
> put "INSERT INTO savemyTable (column1) VALUES (1)  & ";" & cr into tSQL
>
> put "DELETE FROM myTable WHERE id = " & id & ";" & cr after tSQL
>
> revExecuteSQL tDatabaseID, tSQL
>
> if the result is not an integer then answer the result
>
> else …// COMMIT

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Execute multiple MySQL commands

Mark Wieder via use-livecode
I know where! The Dictionary:


SQLStatement string
A string in Structured Query Language. (Do not include a semicolon at the end of the SQLStatement.) >Note: Some database systems, such as Oracle, are capable of handling a multiple-line SQL statement.

Bob S


> On Feb 8, 2018, at 07:34 , Bob Sneidar via use-livecode <[hidden email]> wrote:
>
> I thought I read somewhere that the LC API does not support multiple statements?
>
> Bob S
>
>
>> On Feb 8, 2018, at 02:24 , Ludovic THEBAULT via use-livecode <[hidden email]> wrote:
>>
>> Hello,
>>
>> I’ve an « syntax error » as result if i want to execute multiple MySQL commands, even with transactions.
>>
>> It is normal ? If i execute one command at time, it’s work.
>>
>> Thanks !
>>
>>
>>
>> Here a sample script :
>>
>> revExecuteSQL tDatabaseID,"BEGIN TRANSACTION »
>>
>> put "INSERT INTO savemyTable (column1) VALUES (1)  & ";" & cr into tSQL
>>
>> put "DELETE FROM myTable WHERE id = " & id & ";" & cr after tSQL
>>
>> revExecuteSQL tDatabaseID, tSQL
>>
>> if the result is not an integer then answer the result
>>
>> else …// COMMIT
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Execute multiple MySQL commands

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode

> Le 8 févr. 2018 à 16:34, Bob Sneidar via use-livecode <[hidden email]> a écrit :
>
> I thought I read somewhere that the LC API does not support multiple statements?
>
> Bob S


Ok, thanks !
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Execute multiple MySQL commands

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode

> Le 8 févr. 2018 à 16:48, Bob Sneidar via use-livecode <[hidden email]> a écrit :
>
> I know where! The Dictionary:
>
>
> SQLStatement string
> A string in Structured Query Language. (Do not include a semicolon at the end of the SQLStatement.) >Note: Some database systems, such as Oracle, are capable of handling a multiple-line SQL statement.
>
> Bob S


Just for infos, multiple statements works with SQLite but not with Mysql.
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Execute multiple MySQL commands

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
NP. From the dictionary statement about *some* database systems supporting multiple SQL statements, I gather that *some* do not, so they have to take the lowest common denominator approach.

Bob S


> On Feb 8, 2018, at 08:07 , Ludovic THEBAULT via use-livecode <[hidden email]> wrote:
>
>> Le 8 févr. 2018 à 16:34, Bob Sneidar via use-livecode <[hidden email]> a écrit :
>>
>> I thought I read somewhere that the LC API does not support multiple statements?
>>
>> Bob S
>
>
> Ok, thanks !

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Execute multiple MySQL commands

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
On Thu, Feb 8, 2018 at 8:20 AM, Ludovic THEBAULT via use-livecode <
[hidden email]> wrote:

>
>
> Just for infos, multiple statements works with SQLite but not with Mysql.


They also work with postgreSQL.

This was a major factor in my switching.

I think mySQL now has rollback, but it didn't have fun rollback at the
time, either.

Overall, postgres is the more mature/stable of the two, but it doesn't come
"canned" on very many ISPs.
--
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode