Page 1 of 1

how can detail error cannot retrieve resultset data ?

Posted: 08.12.2015, 16:37
by ovural
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 ?

Re: how can detail error cannot retrieve resultset data ?

Posted: 03.01.2016, 18:53
by marsupilami
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

Re: how can detail error cannot retrieve resultset data ?

Posted: 04.04.2016, 12:58
by ovural
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 ?

Re: how can detail error cannot retrieve resultset data ?

Posted: 04.04.2016, 21:18
by marsupilami
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

Re: how can detail error cannot retrieve resultset data ?

Posted: 26.04.2016, 07:58
by ovural
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?

Re: how can detail error cannot retrieve resultset data ?

Posted: 02.06.2016, 10:32
by ovural
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;