how can detail error cannot retrieve resultset data ?

The official tester's forum for ZeosLib 7.1. Ask for help, post proposals or solutions.
ovural
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 08.04.2009, 15:29

how can detail error cannot retrieve resultset data ?

Postby ovural » 08.12.2015, 16:37

i use procedure with Zquery ..

for example

Code: Select all

ZQuery1.SQL.Text := 'select table(0)';
ZQuery1.Open;


i want to get detail error ..


how can i ?

marsupilami
Gold Boarder
Gold Boarder
Posts: 591
Joined: 17.01.2011, 14:17

Re: how can detail error cannot retrieve resultset data ?

Postby marsupilami » 03.01.2016, 18:53

Hello ovural,

honestly, I don't understand your question. Ehat kind of detail error do you expect? Why do you expect some error from this code?
With best regards,

Jan

ovural
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 08.04.2009, 15:29

Re: how can detail error cannot retrieve resultset data ?

Postby ovural » 04.04.2016, 12:58

for example ..

table create code ..

Code: Select all

CREATE TABLE `tb_table` (
   `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
   `name` VARCHAR(50) NULL DEFAULT '0',
   PRIMARY KEY (`id`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;



function code

Code: Select all

CREATE FUNCTION `tb`()
   RETURNS INT
   LANGUAGE SQL
   DETERMINISTIC
   CONTAINS SQL
   SQL SECURITY DEFINER
   COMMENT ''
BEGIN

   insert into tb_table (id,n) values ('','example');
   return 1;
   
END



i have error with zeos (attach : error.png)

on heidisql (attach : error2.png) ..


how can i get error detail as error2.png ?
You do not have the required permissions to view the files attached to this post.

marsupilami
Gold Boarder
Gold Boarder
Posts: 591
Joined: 17.01.2011, 14:17

Re: how can detail error cannot retrieve resultset data ?

Postby marsupilami » 04.04.2016, 21:18

Hello ovural,

in your example the problem is in the procedure in the following line:
insert into tb_table (id,n) values ('','example');

You don't have a column n in your table declaration. It should be this:
insert into tb_table (id, name) values ('','example');

or something like this:
insert into tb_table (`id`,`name`) values ('','example');

With best regards,

Jan

ovural
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 08.04.2009, 15:29

Re: how can detail error cannot retrieve resultset data ?

Postby ovural » 26.04.2016, 07:58

Hello marsuplami,

In my example, I know where is the problem and I also know how can i fix it. I make this problem myself to explain what I want.

I have a program which is coded with delphi, and it works with mysql. I get error from mysql in my program but it says just "Cannot retrieve Resultset data." and explains nothing. The same problem in heidisql can say to me what is the error in detail, like "Unknown column 'n' in 'field list' ". I want to see this details in my program to fix my errors easily.

How can I do this?

ovural
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 08.04.2009, 15:29

Re: how can detail error cannot retrieve resultset data ?

Postby ovural » 02.06.2016, 10:32

i have solved my problem ..

in file ZDbcMySqlResultSet

Code: Select all

procedure TZMySQLResultSet.Open;
var
  I: Integer;
  FieldHandle: PZMySQLField;
begin
  if ResultSetConcurrency = rcUpdatable then
    raise EZSQLException.Create(SLiveResultSetsAreNotSupported);

  if FUseResult and (not FIgnoreUseResult) then
  begin
    FQueryHandle := FPlainDriver.UseResult(FHandle);
    LastRowNo := 0;
  end
  else
  begin
    FQueryHandle := FPlainDriver.StoreResult(FHandle);
    if Assigned(FQueryHandle) then
      LastRowNo := FPlainDriver.GetRowCount(FQueryHandle)
    else
      LastRowNo := 0;
  end;

  if not Assigned(FQueryHandle) then
    raise EZSQLException.Create(SCanNotRetrieveResultSetData);

  { Fills the column info. }
  ColumnsInfo.Clear;
  for I := 0 to FPlainDriver.GetFieldCount(FQueryHandle) - 1 do
  begin
    FPlainDriver.SeekField(FQueryHandle, I);
    FieldHandle := FPlainDriver.FetchField(FQueryHandle);
    if FieldHandle = nil then
      Break;

    ColumnsInfo.Add(GetMySQLColumnInfoFromFieldHandle(FPlainDriver,
     FieldHandle, ConSettings, FUseResult));
  end;

  inherited Open;
end;


add

Code: Select all

uses ZDbcLogging;


change this

Code: Select all

procedure TZMySQLResultSet.Open;
var
  I: Integer;
  FieldHandle: PZMySQLField;
  LogSQL: String;
begin
  if ResultSetConcurrency = rcUpdatable then
    raise EZSQLException.Create(SLiveResultSetsAreNotSupported);

  if FUseResult and (not FIgnoreUseResult) then
  begin
    FQueryHandle := FPlainDriver.UseResult(FHandle);
    LastRowNo := 0;
  end
  else
  begin
    FQueryHandle := FPlainDriver.StoreResult(FHandle);
    if Assigned(FQueryHandle) then
      LastRowNo := FPlainDriver.GetRowCount(FQueryHandle)
    else
      LastRowNo := 0;
  end;

  if not Assigned(FQueryHandle) then
  begin
    CheckMySQLError(FPlainDriver, FHandle, lcExecute, LogSQL);
    raise EZSQLException.Create(SCanNotRetrieveResultSetData);
  end;

  { Fills the column info. }
  ColumnsInfo.Clear;
  for I := 0 to FPlainDriver.GetFieldCount(FQueryHandle) - 1 do
  begin
    FPlainDriver.SeekField(FQueryHandle, I);
    FieldHandle := FPlainDriver.FetchField(FQueryHandle);
    if FieldHandle = nil then
      Break;

    ColumnsInfo.Add(GetMySQLColumnInfoFromFieldHandle(FPlainDriver,
     FieldHandle, ConSettings, FUseResult));
  end;

  inherited Open;
end;


Return to “ZeosLib 7.1 stable Forum”

Who is online

Users browsing this forum: No registered users and 1 guest