Page 1 of 1

An issue with UniScript.Execute

Posted: Mon 22 Oct 2018 08:23
by SamWin
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

Re: An issue with UniScript.Execute

Posted: Tue 23 Oct 2018 09:57
by Stellar
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.

Re: An issue with UniScript.Execute

Posted: Mon 29 Oct 2018 11:23
by SamWin
How can I execute the SQL statement in its original form, without deleting insignificant spaces or line breaks?

Re: An issue with UniScript.Execute

Posted: Thu 15 Nov 2018 12:21
by Stellar
Unfortunately, removing insignificant spaces and line breaks in an SQL statement is performed automatically, and it is currently impossible to disable this functionality.