#1 2015-10-04 09:28:47

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Is it possible to execute multiple SQL statements at once?

Hi ab,

By nature many DBMS including the SQLITE3 engine supports executing multiple SQL statements delimited by commas, but it seems that both the TSQLRestServer and TSQLDBConnectionProperties do not support comma-separated SQL statements?

Thanks.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#2 2015-10-04 15:52:42

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: Is it possible to execute multiple SQL statements at once?

PS, it's extremely useful when upgrading an existing database if one can execute multi sql statements at a time, for example, execute a bunch of SQLs from a .sql file extracted from a db management tool.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#3 2015-10-04 21:04:34

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Is it possible to execute multiple SQL statements at once?

It is for security reasons.
And to enforce use of ORM instead of SQL.

Use a Batch ORM instead for safe and fast process.

Offline

#4 2015-10-05 08:44:32

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: Is it possible to execute multiple SQL statements at once?

Thanks for the explanation, ab.

I understand it that the REST server (which can be accessed remotely) should not allow multiple SQL execution at a time, but if I'm correct, at the database engine level (which for local access), this function should be exposed.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#5 2015-10-05 09:42:31

Nouba
Member
Registered: 2015-10-05
Posts: 5

Re: Is it possible to execute multiple SQL statements at once?

AFAIK you can execute a SQL script with SQLite3 like.

YourSQLDBSQLite3ConnectionProperties.MainConnection.DB.ExecuteAll(StringFromFile(PathToScript));

Offline

#6 2015-10-05 11:30:12

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: Is it possible to execute multiple SQL statements at once?

Thanks @Nouba, good to know that!


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

Board footer

Powered by FluxBB