Skip to content

Confusing PHP documentation for ibase_trans() #63

Open
@mlazdans

Description

@mlazdans

Reading the PHP documentation, it appears that the order in which we pass link_identifier and trans_args arguments to ibase_trans() does not matter.

Image

However, this is not quite true. If link_identifier is specified first, then the trans_args are silently ignored. Either do not specify link_identifier, or pass it as the last argument.

Upon examining the source code for ibase_trans() it seems that if you want to specify one or more link_identifier then the order should be like this:

ibase_trans(...0 or more trans args..., $db1, ...0 or more trans args..., $db2, ...etc);

I.e. you first specify transaction parameters, followed by link identifier.

I think either documentation should be updated or ibase_trans() should be fixed or at least throw some warning.

Code to reproduce

<?php

$database = "localhost/3070:/opt/db/test.fdb";
$username = "sysdba";
$password = "masterkey";
$charset = "utf-8";

$db = ibase_connect($database, $username, $password, $charset) or die("Could not connect");
$tr = ibase_trans($db, IBASE_READ) or die("Could not create transaction");
ibase_query($tr, "INSERT INTO TEST_TABLE (INT_128) VALUES(123)") or die("Could not insert");
ibase_commit($tr) or die("Could not commit transaction");;
print "Finished OK\n";

Just swap arguments to make it respect transaction parameters:
$tr = ibase_trans(IBASE_READ, $db) or die("Could not create transaction");

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions