BDE Migration to UniDAC with Sybase

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Tue 07 Jun 2011 08:39

Hello,

We've fixed the problem with the "SQL Statement doesnt return rows" error on using 12.5 client in queries like:

if exists(select * from test where ID = 1)
select 'A' else select 'B'

This fix will be included in the next build.

sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Post by sasdua » Tue 07 Jun 2011 14:25

Thanks Alex.

Can you please let me know when you will be releasing the new build.

Also we have encounted another issue in TUniquery with creating temporary tables in tuniquery
for ex create table #tem1
insert #tem1
drop table #tem1

Please let us know can we perform actions on temporary table in Tuniquery


Thanks
AS

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 08 Jun 2011 07:21

Hello,

With the help of UniDAC, you can work with temporary ASE tables like with ordinary ones, for example:

Code: Select all

var
  UniConnection:TUniConnection;
  UniQuery: TUniQuery;
begin
  UniConnection:= TUniConnection.Create(nil);
  try
    UniConnection.ProviderName := 'ASE';
    UniConnection.Server := 'SERVER';
    UniConnection.Port:= 5000;
    UniConnection.Username := 'sa';
    UniConnection.Connect;
    UniConnection.ExecSQL('create table #tem1(id integer)',[]);
    UniConnection.ExecSQL('insert #tem1 values(1)',[]);
    UniQuery:= TUniQuery.Create(nil);
    try
      UniQuery.Connection := UniConnection;
      UniQuery.SQL.Text := 'select * from #tem1';
      UniQuery.Open;
      ShowMessage(UniQuery.FieldByName('id').AsString);
    finally
      UniQuery.Free;
    end;
  finally
    UniConnection.Free;
  end;
The next build will be released next week.

sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Post by sasdua » Thu 09 Jun 2011 08:56

Thanks Alex we will try the below. The existing add the entire query of creating,inserting and selecting the data inside the Tquery component. I will try spliting as you have show below.

Also, could you please let us know once the new build is available , we will download it and start using it . We have already got the license for unidac.

Regards,
AS

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Thu 09 Jun 2011 12:14

Hello,

You can execute several commands with the help of TUniScript. You should separate them by ";", for example:

Code: Select all

UniScript1.SQL.Text := 'create table #tmp(id integer);' + #13 +
                       'insert into #tmp values(1);' + #13 +
                       'select * from #tmp;' + #13 +
                       'drop table #tmp;';
UniScript1.Execute;
We plan to release the next build on Tuesday or Wednesday.

sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Post by sasdua » Mon 13 Jun 2011 10:39

Hi Alex,

When we are do ing like below also we are facing smilar issue

UniQuery.Add('exec get_employee'+EmpId)
UniQuery.ExecSQL(Now we have added this)
Open;
First;


when get_employee using #temp tables ..it is not returning rows.
Could you please help me in finding the soln for this.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Tue 14 Jun 2011 10:48

I cannot reproduce the problem. The code specified below works correctly (the number of records it returns is correct):

Code: Select all

create table t_test
(
id int,
text varchar(10)
)

insert into t_test values(1, 'test_1')
insert into t_test values(2, 'test_1')
insert into t_test values(3, 'test_1')

create procedure sp_test(@id int in)
as 
create table #tmp (id int ,name varchar(10))
insert into #tmp select * from t_test  where id >@id
select * from #tmp
drop table #tmp

Code: Select all

var
  UniStoredProc: TUniStoredProc;
begin
  UniStoredProc:= TUniStoredProc.Create(nil);
  UniStoredProc.Connection:= UniConnection1;
  UniStoredProc.StoredProcName := 'sp_test';
  UniStoredProc.Prepare;
  UniStoredProc.ParamByName('id').AsInteger := 1;
  UniStoredProc.Open;
  ShowMessage(IntToStr(TDataSet(UniStoredProc).RecordCount));

Please modify this code so that the error can be reproduced or provide your own example.

sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Post by sasdua » Wed 15 Jun 2011 09:05

AlexP wrote:Hello,

We've fixed the problem with the "SQL Statement doesnt return rows" error on using 12.5 client in queries like:

if exists(select * from test where ID = 1)
select 'A' else select 'B'

This fix will be included in the next build.
Is it fixed?

Can we download from our account?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 15 Jun 2011 09:53

Hello,

Yes, this problem is fixed. You will be able to download the new version tomorrow.

sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Post by sasdua » Wed 15 Jun 2011 12:58

Thanks Alex for the update. Will download the buiild tomorrow and will let u know.

sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Post by sasdua » Thu 16 Jun 2011 09:48

AlexP wrote:I cannot reproduce the problem. The code specified below works correctly (the number of records it returns is correct):

Code: Select all

create table t_test
(
id int,
text varchar(10)
)

insert into t_test values(1, 'test_1')
insert into t_test values(2, 'test_1')
insert into t_test values(3, 'test_1')

create procedure sp_test(@id int in)
as 
create table #tmp (id int ,name varchar(10))
insert into #tmp select * from t_test  where id >@id
select * from #tmp
drop table #tmp
var
UniStoredProc: TUniStoredProc;
begin
UniStoredProc:= TUniStoredProc.Create(nil);
UniStoredProc.Connection:= UniConnection1;
UniStoredProc.StoredProcName := 'sp_test';
UniStoredProc.Prepare;
UniStoredProc.ParamByName('id').AsInteger := 1;
UniStoredProc.Open;(here)

ShowMessage(IntToStr(TDataSet(UniStoredProc).RecordCount));

Please modify this code so that the error can be reproduced or provide your own example.
thanks alex..but when am trying this it is trowing error message like "Parameter '@id' is not declared as OUTPUT parameter"

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Thu 16 Jun 2011 11:40

Hello,

Please try to set the type of the procedure parameter explicitly, like:

Code: Select all

...
UniStoredProc.Prepare; 
UniStoredProc.ParamByName('id').ParamType:= ptInput;
UniStoredProc.ParamByName('id').AsInteger := 1;
...

sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Post by sasdua » Mon 20 Jun 2011 11:58

IMPLICIT CONVERSION FROM DATATYPE 'VARCHAR' TO 'INT' IS NOT ALLOWED. USE THE CONVERT FUNCTION TO RUN THIS QUERY.

When am executing a SP,am getting the above error what might be the issue..am sending params correclty still am getting above error.

sasdua
Posts: 73
Joined: Wed 16 Mar 2011 15:06

Post by sasdua » Mon 20 Jun 2011 11:59

AlexP wrote:Hello,

Please try to set the type of the procedure parameter explicitly, like:

Code: Select all

...
UniStoredProc.Prepare; 
UniStoredProc.ParamByName('id').ParamType:= ptInput;
UniStoredProc.ParamByName('id').AsInteger := 1;
...
this got resloved i used saparate storedproc in each case..and i have removed Prepare also.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Tue 21 Jun 2011 08:37

Hello,

The code I've specified above works on our ASE servers correctly. Such problems may be caused by some specific server, client, or OS settings.

P.S. Unfortunately, we cannot fix a problem until we are able to reproduce it.

Post Reply