An issue with UniScript.Execute

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
SamWin
Posts: 2
Joined: Thu 04 Oct 2018 09:45

An issue with UniScript.Execute

Post by SamWin » Mon 22 Oct 2018 08:23

I have a question with working of UniScript.Execute;

I transfer in UniScript.SQL.Text in Delphi this script on creating stored procedure in Sybase:

Code: Select all

use data
go
if exists(select 1
                               from sysobjects
                               where id=object_id('dbo.LOG_SP_LIST_TEST')
                               and type='P')
                drop procedure dbo.LOG_SP_LIST_TEST
go
create procedure LOG_SP_LIST_TEST
  @database varchar(30)
as
begin        

select 1

end



go
grant execute on dbo.LOG_SP_LIST_TEST to public /*dbo*/
revoke execute on dbo.LOG_SP_LIST_TEST from integration /*dbo*/
revoke execute on dbo.LOG_SP_LIST_TEST from distribution /*dbo*/
revoke execute on dbo.LOG_SP_LIST_TEST from etl /*dbo*/
revoke execute on dbo.LOG_SP_LIST_TEST from calc /*dbo*/
revoke execute on dbo.LOG_SP_LIST_TEST from table_reserve /*dbo*/
revoke execute on dbo.LOG_SP_LIST_TEST from idm /*dbo*/
revoke execute on dbo.LOG_SP_LIST_TEST from helpdesk /*dbo*/

go
I am executing it UniScript.Execute and somehow in database publishing this:

Code: Select all

use data
go
if exists(select 1
                               from sysobjects
                               where id=object_id('dbo.LOG_SP_LIST_TEST')
                               and type='P')
                drop procedure dbo.LOG_SP_LIST_TEST
go
create procedure LOG_SP_LIST_TEST
  @database varchar(30)
as
begin        

select 1

end
*Here were an empty lines and they’re deleted themselves*
go
grant execute on dbo.LOG_SP_LIST_TEST to public /*dbo*/
revoke execute on dbo.LOG_SP_LIST_TEST from integration /*dbo*/
revoke execute on dbo.LOG_SP_LIST_TEST from distribution /*dbo*/
revoke execute on dbo.LOG_SP_LIST_TEST from etl /*dbo*/
revoke execute on dbo.LOG_SP_LIST_TEST from calc /*dbo*/
revoke execute on dbo.LOG_SP_LIST_TEST from table_reserve /*dbo*/
revoke execute on dbo.LOG_SP_LIST_TEST from idm /*dbo*/
revoke execute on dbo.LOG_SP_LIST_TEST from helpdesk /*dbo*/

go

I meant, that in component UniScript.SQL.Text I’m transferred script with transferences of the lines (empty lines) after line, where they are deleted after the command «end» in request and after execution UniScript.Execute.
When I’m adding in script an empty lines before and after a command «GO» and after this executing a script, my database receiving saving procedure with deleted empty lines
I want to save an empty lines before and after command «GO» when I am creating a saving procedure.

How can I fix this issue?

I am working with:
Delphi XE2 Version 16
UniDAC Ver. 7.3.8
DataBase ASE Sybase

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: An issue with UniScript.Execute

Post by Stellar » Tue 23 Oct 2018 09:57

Please explain how you got the script with missing lines. The 'GO' operator splits the script into SQL statements executed sequentially. We can delete insignificant spaces and line breaks in SQL statements.

SamWin
Posts: 2
Joined: Thu 04 Oct 2018 09:45

Re: An issue with UniScript.Execute

Post by SamWin » Mon 29 Oct 2018 11:23

How can I execute the SQL statement in its original form, without deleting insignificant spaces or line breaks?

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: An issue with UniScript.Execute

Post by Stellar » Thu 15 Nov 2018 12:21

Unfortunately, removing insignificant spaces and line breaks in an SQL statement is performed automatically, and it is currently impossible to disable this functionality.

Post Reply