Bug #64937 [Com]: Unable to run firebird "execute block", containing :xxxx
| From: | slavb18 at gmail dot com | Date: | Tue, 28 May 2013 13:52:57 +0000 |
| Subject: | Bug #64937 [Com]: Unable to run firebird "execute block", containing :xxxx | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-179181@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64937&edit=1
ID: 64937
Comment by: slavb18 at gmail dot com
Reported by: slavb18 at gmail dot com
Summary: Unable to run firebird "execute block", containing
:xxxx
Status: Open
Type: Bug
Package: PDO related
PHP Version: 5.4.15
Block user comment: N
Private report: N
New Comment:
don't know if it helps, but this is working example with parametrized execute block with
ibase_XXX functions
$conn=ibase_connect($base, $user,$pass);
$q="Execute Block
(
test integer=?
)
Returns(
result varchar(100)
)
as
Begin
select 'test' from rdb\$database where 1=:test into result;
Suspend;
End
";
$qu= ibase_prepare($conn,$q);
$r_sql = ibase_execute($qu,1);
$row=ibase_fetch_assoc($r_sql);
print_r($row);
Previous Comments:
------------------------------------------------------------------------
[2013-05-28 13:36:07] slavb18 at gmail dot com
Description:
------------
Unable to run firebird unparametrized "execute block", containing :xxxx
if query contains string like ":xxxx", pdo->query shows error
SQLSTATE[HY000]: General error: -901 Dynamic SQL Error SQL error code = -901 undefined message
number
if I remove "where 1=:test", then execute block works
And, also I cannot prepare and execute "paramerized" execute block if it contains :xxxxx
Execute Block
(
test integer=:test
)
Returns(
result varchar(100)
)
as
Begin
select 'test' from rdb$database where 1=:test
into result;
Suspend;
End
I think solution is to ignore any parameters (:xxx) after Begin keyword
in case of firebird
Test script:
---------------
$q="Execute Block
Returns(
result varchar(100)
)
as
declare variable test integer=1;
Begin
select 'test' from rdb\$database where 1=:test
into result;
Suspend;
End
";
$sth=$pdo->query($q);
$row=$sth->fetch(PDO::FETCH_ASSOC);
Expected result:
----------------
Array
(
[RESULT] => test
)
Actual result:
--------------
SQLSTATE[HY000]: General error: -901 Dynamic SQL Error SQL error code = -901 undefined message
number
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64937&edit=1