Subject | Re: [firebird-php] Re: Serious PHP question |
---|---|
Author | Daniela Mariaschi |
Post date | 2003-06-24T09:24:24Z |
> On the 'Real' Serious PHP questionspaces) -
>
> > Nope. I put that in the example to prevent the idea that the original
> >> $name->STR_TEST had any size or quoting inside it.
> >> In my application, it's rattling though an array of varchars(with
> >> doing a prepare every time(just using ibase_query) makes it runincredibly
> >> slow...stops
> >>
> >> If the string has spaces, it dies.
> >> I've just had an idea, that may be the cause...nope. Dies silently(and
> >> all output)Hi all,
>
> Any input from the newer 'joiners'?
It seems I lost the start (and the issue) about this thread.
I'm a bit confused ....
Couldn't you reproduce the errors you receive in the shortest script
possible ?
I tried to run a little test and all seems ok ......
===================================================
original DDL
===================================================
create table tbl_test (
str_test VARCHAR(100)
);
create procedure sp_find (str_test varchar(100) )
returns ( int_count INTEGER )
AS BEGIN
select count(*) from tbl_test where str_test = :str_test INTO :int_count;
suspend;
END
====================================================
SCRIPT example
====================================================
<?
$host = "localhost:/opt/interbase/db/test.gdb";
$user = "SYSDBA";
$pwd = "test";
$dbh = ibase_connect($host, $user, $pwd, NULL, NULL, 3); //dialect 3
// first let's introduce our string test
$input = "TEST WITH _SOME_ SPACE HERE";
$q = "insert into tbl_test values('". $input . "')" ;
ibase_query( $q);
// then let's retrive it just to store the string into a variable
$res = ibase_query("select str_test from tbl_test");
$arr = ibase_fetch_assoc($res);
//print_r($arr);
// then let's the store procedure look for it
$prep = ibase_prepare("select * from sp_find(?)");
$res = ibase_execute($prep, $arr['STR_TEST']);
while ($row = ibase_fetch_assoc($res)){
print_r($row);
}
ibase_rollback($dbh); //discard insert
ibase_close($dbh);
?>
====================================================
TEST output
====================================================
$ php -q test.php
Array
(
[INT_COUNT] => 1
)
Hope this help.
(and hope Nigels read this newsgroup as well ..... ;) )
Daniela