Skip to content

Order of INSERT parameters cause "Incorrect values within SQLDA structure" #77

@mlazdans

Description

@mlazdans

PHP 8.4 64-bit Linux / PHP 7.4 64-bit Windows

Compile-time Client Library Version => Firebird API version 50
Run-time Client Library Version => LI-V6.3.2.1613 Firebird 5.0 / LI-V6.3.11.33637 Firebird 3.0

Compile-time Client Library Version => Firebird API version 30
Run-time Client Library Version => LI-V6.3.2.1613 Firebird 5.0 / LI-V6.3.11.33637 Firebird 3.0

CREATE TABLE TTEST
(
  TTYPE VARCHAR(1) NOT NULL,
  F8 NUMERIC(9,2)
);
(function() {
	ibase_connect("localhost/3050:/tmp/test.fdb", "sysdba", "masterkey", "utf8");
	$tr = ibase_trans();

	$data = [
		'TTYPE'=>'S',
		'F8'=>'',
	];

	$fields_str = join(",", array_keys($data));
	$q_str = join(",", array_fill(0, count($data), "?"));
	$sql = "INSERT INTO TTEST($fields_str) VALUES ($q_str)";

	if(ibase_query($tr, $sql, ...array_values($data))){
		ibase_commit($tr);
	}
})();

This will error:

Warning: ibase_query(): Incorrect values within SQLDA structure empty pointer to data at SQLVAR index 0

Now swap the order and no errors

	$data = [
		'F8'=>'',
		'TTYPE'=>'S',
	];

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions