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:

patched version opensuse build service project:
https://build.opensuse.org/package/show?package=php5&project=home%3Aslavb18%3Abranches%3Adevel%3Alanguages%3Aphp

rpms:
http://download.opensuse.org/repositories/home:/slavb18:/branches:/devel:/languages:/php/openSUSE_12.3/


Previous Comments:
------------------------------------------------------------------------
[2013-05-28 13:52:57] slavb18 at gmail dot com

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);

------------------------------------------------------------------------
[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

Reply via email to