Bug #61939 [Com]: PDO_FIREBIRD incorrect result of query for NUMERIC(x, y) type in 1 dialect

2013-09-16 Thread slavb18 at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=61939&edit=1

 ID: 61939
 Comment by: slavb18 at gmail dot com
 Reported by:sim-mail at list dot ru
 Summary:PDO_FIREBIRD incorrect result of query for
 NUMERIC(x, y) type in 1 dialect
 Status: Not a bug
 Type:   Bug
 Package:PDO related
 Operating System:   Windows 7 32bit
 PHP Version:5.3.12
 Assigned To:mariuz
 Block user comment: N
 Private report: N

 New Comment:

dialect 1 returning SQL_DOUBLE with var->sqlscale < 0
with quick and dirty patch ignoring var->sqlscale for SQL_DOUBLE, it works but 
returns not so pretty double numbers (with six digits after comma, like 
123.45 istead of 123.45)


Previous Comments:

[2012-07-06 07:52:51] mar...@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Please use dialect 3 that is the default dialect for firebird 2.5 
Dialect 1 will be deprecated


[2012-07-06 06:26:39] mar...@php.net

Currently it is possible to create databases in Dialect 1 and 3 only, however 
it 
is recommended that you use Dialect 3 exclusively, since Dialect 1 will 
eventually be deprecated.


[2012-06-26 15:50:14] manubing at gmail dot com

Also affected on macosx using PHP 5.3.10 and debian lenny with PHP 
5.2.6-1+lenny16.

Something odd: incorrect results are the same for a column for all rows fetched:
using the previous example:

public 'COST' => string '1.00' <-- Error

All rows fetched will have 'COST' set to '1.00' (even if actual values differs)


Running again the query will give another (eg: '600.00') incorrect value, 
the same on all rows again.


[2012-05-04 14:53:01] sim-mail at list dot ru

only 1 dialect


[2012-05-04 14:50:22] sim-mail at list dot ru

Description:

PDO_FIREBIRD incorrect result of query for NUMERIC(x, y) or DECIMAL (x, y) type

setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sth = $dbh->prepare($sql);
$sth->execute();
$obj = $sth->fetch();
var_dump($obj);
$sth = null;
?>

Script print 

object(stdClass)[3]
  public 'ID' => string '1' (length=1)
  public 'NAME' => string 'my price' (length=8)
  public 'COST' => string '1.00' (length=4) <-- Error hear (correct result 
12.34)

Test script:
---
Sql script for create database

SET SQL DIALECT 1;
SET NAMES WIN1251;

CREATE DATABASE 'LOCALHOST:D:\interbasedata\test.fdb'
USER 'SYSDBA' PASSWORD 'masterkey'
PAGE_SIZE 16384
DEFAULT CHARACTER SET WIN1251 COLLATION WIN1251;

CREATE TABLE PRICE (
IDINTEGER NOT NULL,
NAME  VARCHAR(10),
COST  NUMERIC(15,2)
);

INSERT INTO PRICE (ID, NAME, COST) VALUES (1, 'my price', 12.34);

COMMIT WORK;

ALTER TABLE PRICE ADD CONSTRAINT PK_PRICE PRIMARY KEY (ID);







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61939&edit=1


[PHP-BUG] Bug #65689 [NEW]: PDO_Firebird memory leaks when using exec()

2013-09-17 Thread slavb18 at gmail dot com
From: slavb18 at gmail dot com
Operating system: any
PHP version:  5.4.19
Package:  PDO related
Bug Type: Bug
Bug description:PDO_Firebird memory leaks when using exec()

Description:

function firebird_handle_doer calls firebird_alloc_prepare_stmt 
and should call isc_dsql_free_statement


-- 
Edit bug report at https://bugs.php.net/bug.php?id=65689&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65689&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65689&r=trysnapshot53
Try a snapshot (trunk): 
https://bugs.php.net/fix.php?id=65689&r=trysnapshottrunk
Fixed in SVN:   https://bugs.php.net/fix.php?id=65689&r=fixed
Fixed in release:   https://bugs.php.net/fix.php?id=65689&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=65689&r=needtrace
Need Reproduce Script:  https://bugs.php.net/fix.php?id=65689&r=needscript
Try newer version:  https://bugs.php.net/fix.php?id=65689&r=oldversion
Not developer issue:https://bugs.php.net/fix.php?id=65689&r=support
Expected behavior:  https://bugs.php.net/fix.php?id=65689&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=65689&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=65689&r=submittedtwice
register_globals:   https://bugs.php.net/fix.php?id=65689&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65689&r=php4
Daylight Savings:   https://bugs.php.net/fix.php?id=65689&r=dst
IIS Stability:  https://bugs.php.net/fix.php?id=65689&r=isapi
Install GNU Sed:https://bugs.php.net/fix.php?id=65689&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65689&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=65689&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65689&r=mysqlcfg



[PHP-BUG] Bug #65690 [NEW]: PDO_Firebird returns wrong results with numeric 15,2 and dialect 1

2013-09-17 Thread slavb18 at gmail dot com
From: slavb18 at gmail dot com
Operating system: any
PHP version:  5.4.19
Package:  PDO related
Bug Type: Bug
Bug description:PDO_Firebird  returns wrong results with numeric 15,2 and 
dialect 1

Description:

PDO_Firebird  returns wrong results with numeric (15,2) and dialect 1
dialect 1 returns numeric (15,2) as  SQL_DOUBLE and sqlscale < 0,

I know this was reported before but this report is with patch 

Test script:
---
create or alter procedure testpdo
returns (
res numeric(15,2),
res2 numeric(5,2))
as
begin
  RES=123.45;
  RES2=123.45;
  suspend;
end

Expected result:

Array
(
[RES] => 123.45
[0] => 123.45
[RES2] => 123.45
[1] => 123.45
)


Actual result:
--
Array
(
[RES] => 0.04
[0] => 0.04
[RES2] => 123.45
[1] => 123.45
)


(or any other number istead of 0.04 as variable "n" is unitilized in case
of SQL_DOUBLE)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=65690&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65690&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65690&r=trysnapshot53
Try a snapshot (trunk): 
https://bugs.php.net/fix.php?id=65690&r=trysnapshottrunk
Fixed in SVN:   https://bugs.php.net/fix.php?id=65690&r=fixed
Fixed in release:   https://bugs.php.net/fix.php?id=65690&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=65690&r=needtrace
Need Reproduce Script:  https://bugs.php.net/fix.php?id=65690&r=needscript
Try newer version:  https://bugs.php.net/fix.php?id=65690&r=oldversion
Not developer issue:https://bugs.php.net/fix.php?id=65690&r=support
Expected behavior:  https://bugs.php.net/fix.php?id=65690&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=65690&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=65690&r=submittedtwice
register_globals:   https://bugs.php.net/fix.php?id=65690&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65690&r=php4
Daylight Savings:   https://bugs.php.net/fix.php?id=65690&r=dst
IIS Stability:  https://bugs.php.net/fix.php?id=65690&r=isapi
Install GNU Sed:https://bugs.php.net/fix.php?id=65690&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65690&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=65690&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65690&r=mysqlcfg



Bug #65690 [Com]: PDO_Firebird returns wrong results with numeric 15,2 and dialect 1

2013-09-17 Thread slavb18 at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=65690&edit=1

 ID: 65690
 Comment by: slavb18 at gmail dot com
 Reported by:slavb18 at gmail dot com
 Summary:PDO_Firebird  returns wrong results with numeric
 15,2 and dialect 1
 Status: Open
 Type:   Bug
 Package:PDO related
 Operating System:   any
 PHP Version:5.4.19
 Block user comment: N
 Private report: N

 New Comment:

forget to attach php script:

...
$sql="select * FROM TESTPDO";
$sth = $pdo->prepare($sql);
$sth->execute();
$obj = $sth->fetch();
print_r($obj);


Previous Comments:

[2013-09-17 13:14:57] slavb18 at gmail dot com

Description:

PDO_Firebird  returns wrong results with numeric (15,2) and dialect 1
dialect 1 returns numeric (15,2) as  SQL_DOUBLE and sqlscale < 0,

I know this was reported before but this report is with patch 

Test script:
---
create or alter procedure testpdo
returns (
res numeric(15,2),
res2 numeric(5,2))
as
begin
  RES=123.45;
  RES2=123.45;
  suspend;
end

Expected result:

Array
(
[RES] => 123.45
[0] => 123.45
[RES2] => 123.45
[1] => 123.45
)


Actual result:
--
Array
(
[RES] => 0.04
[0] => 0.04
[RES2] => 123.45
[1] => 123.45
)


(or any other number istead of 0.04 as variable "n" is unitilized in case of 
SQL_DOUBLE)






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65690&edit=1


Bug #65689 [Com]: PDO_Firebird memory leaks when using exec()

2013-09-17 Thread slavb18 at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=65689&edit=1

 ID: 65689
 Comment by: slavb18 at gmail dot com
 Reported by:slavb18 at gmail dot com
 Summary:PDO_Firebird memory leaks when using exec()
 Status: Feedback
 Type:   Bug
 Package:PDO related
 Operating System:   any
 PHP Version:5.4.19
 Block user comment: N
 Private report: N

 New Comment:

memory leaks at firebird side, noticeable with persistent connects (process 
size grows constantly)
I added isc_dsql_free_statement (see patch), and now is ok


Previous Comments:

[2013-09-17 21:46:44] fel...@php.net

Can you include a valgrind log of memory leak for futher analysis?


[2013-09-17 11:23:04] slavb18 at gmail dot com

Description:

function firebird_handle_doer calls firebird_alloc_prepare_stmt 
and should call isc_dsql_free_statement







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65689&edit=1


Req #64603 [Com]: missing function to close persistent connection

2013-09-17 Thread slavb18 at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=64603&edit=1

 ID: 64603
 Comment by: slavb18 at gmail dot com
 Reported by:slavb18 at gmail dot com
 Summary:missing function to close persistent connection
 Status: Open
 Type:   Feature/Change Request
 Package:PDO related
 Operating System:   Any
 PHP Version:5.3.23
 Block user comment: N
 Private report: N

 New Comment:

with pdo_firebird_check_liveness now works ok,
no more shutdown connections returned to php


Previous Comments:

[2013-05-25 09:21:01] michael at mjburgess dot co dot uk

I've confirmed this


[2013-04-07 07:24:16] slavb18 at gmail dot com

may be there is also third way to resolve problem

1. PDO class should have function
public function isValid(){
return TRUE; // or some embedded functional like start/finish transaction ? 
dont know how it work with other drivers
}
2. derived class override & implement method isValid() (like in my example)
3. php before returning PDO class from connection pool should call isValid() 
method, and if validation the result is false, then automatically refresh 
connection


[2013-04-07 07:13:03] slavb18 at gmail dot com

there is similiar Bug #40681 with oracle


[2013-04-07 07:11:12] slavb18 at gmail dot com

Description:

PHP PDO class is missing ability to close persistent connection:
__destruct does not close it, even if I call 
setAttribute(PDO::ATTR_PERSISTENT,FALSE) before destruction
May be __destruct should analyze PDO::ATTR_PERSISTENT attribute or there should 
be explicit function to close persistent connection.

Need to close invalid (shutdown) peristent connection demonstrate example below:

Example with firebird:
1. establish persistent connect in php
2. shutdown connection on server
3. try to get persistent connect from php again
there will be error "General error: -902 connection shutdown"

I can check connection validity in my pdo derived class like this:
public function isValid(){
$valid=TRUE;
try {
$this->beginTransaction();
$this->commit();
} catch (PDOException $e){
$valid=FALSE;
}
return $valid;
}

but I can not "refresh" or "close" my broken connection, there is no function 
to free it in php connection pool







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64603&edit=1


Req #63105 [Com]: Default transanction isolation level in PHP for Firebird in php.ini

2013-09-24 Thread slavb18 at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=63105&edit=1

 ID: 63105
 Comment by: slavb18 at gmail dot com
 Reported by:mar...@php.net
 Summary:Default transanction isolation level in PHP for
 Firebird in php.ini
 Status: Assigned
 Type:   Feature/Change Request
 Package:InterBase related
 Operating System:   All
 PHP Version:Irrelevant
 Assigned To:mariuz
 Block user comment: N
 Private report: N

 New Comment:

examples: 
$pdo->setAttribute(PDO::ATTR_READONLY, FALSE); // read-write transaction 
(Default)
$pdo->setAttribute(PDO::ATTR_READONLY, TRUE); // readonly transaction


$pdo->setAttribute(PDO::ATTR_TIMEOUT, 0); // no_wait
$pdo->setAttribute(PDO::ATTR_TIMEOUT, -1); // wait 
$pdo->setAttribute(PDO::ATTR_TIMEOUT, 4); // wait timeout 4 seconds

$pdo->setAttribute(PDO::FB_TRANS_ISOLATION_LEVEL, PDO::FB_TRANS_COMMITTED); 
//read committed (default)

... etc FB_TRANS_COMMITTED_NO_REC_VERSION, FB_TRANS_CONCURRENCY, 
FB_TRANS_CONCURRENCY


Previous Comments:

[2012-09-18 07:52:40] mar...@php.net

Discussion on firebird php list 


http://tech.groups.yahoo.com/group/firebird-php/message/3758


[2012-09-18 07:18:47] mar...@php.net

Description:

 If you start a new transaction (or if one is started internally, where you 
cannot change the isolation level) where you don’t explicitly specify 
isolation 
level the IBASE_DEFAULT is used. But this is 
IBASE_WRITE|IBASE_CONCURRENCY|IBASE_WAIT. This is read-write wait transaction 
in 
concurrency mode. This mode is most restrictive, nothing close to read 
committed. 
And to make it worse, there’s no way to change this default value in runtime. 
You 
can only do it recompiling sources, nothing to be viable in most cases.

http://blog.cincura.net/233007-default-transanction-isolation-level-in-php-for-
firebird/







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63105&edit=1


Bug #60052 [Com]: Integer returned as a 64bit integer on X64_86

2013-09-25 Thread slavb18 at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=60052&edit=1

 ID: 60052
 Comment by: slavb18 at gmail dot com
 Reported by:m dot vanduren at jonker dot nl
 Summary:Integer returned as a 64bit integer on X64_86
 Status: Assigned
 Type:   Bug
 Package:PDO related
 Operating System:   All (linux tested)
 PHP Version:5.3.8
 Assigned To:mariuz
 Block user comment: N
 Private report: N

 New Comment:

why this patch only partially accepted? still not working on x86-64
$q="select * FROM RDB\$DATABASE";
$q="execute block
returns (
rI integer)
as
begin
rI= -1;
suspend;
end";
$res=$pdo->dbExecute($q);
print_r($res->fetch());

outputs
Array
(
[RI] => 4294967295
[0] => 4294967295
)
istead of
Array
(
[RI] => -1
[0] => -1
)


Previous Comments:

[2012-04-02 14:04:37] mar...@php.net

LL_MASK it should be already be "l" see the php_pdo_firebird_int.h:# define 
LL_MASK "l"

So in the in the slprintf 
slprintf(*ptr, CHAR_BUF_LEN, "%" LL_MASK "d", *(ISC_INT64*)var->sqldata);
should be replaced with 

slprintf(*ptr, CHAR_BUF_LEN, "%" "l" "d", *(ISC_INT64*)var->sqldata);

I will check and create a test for 5.3.x


[2011-10-13 13:01:36] m dot vanduren at jonker dot nl

Description:

Integer on firebird is treated as a 32 bit int and int64 is used as a 64 bit 
integer.
In the pdo_firebird driver INT64 is not implemented and LONG (int32) is treated 
as a long integer. On an x86_64 machine this means that a SQL_LONG doesn't 
honor the bit-sign in a value and INT64 doesn't return anything.

This patch should fix this value for x86_64 systems while leaving x86 systems 
unchanged.

Test script:
---
any firebirdSQL database with a integer field containing a negative value.
retrieve the value with the pdo_firebird driver on a 64 bit machine and echo it 
to the screen.

Expected result:

negative values with integer and should be returned as a negative number.

Actual result:
--
negative values are returned as their unsigned counterpart.






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60052&edit=1


[PHP-BUG] Req #64603 [NEW]: missing function to close persistent connection

2013-04-07 Thread slavb18 at gmail dot com
From: slavb18 at gmail dot com
Operating system: Any
PHP version:  5.3.23
Package:  PDO related
Bug Type: Feature/Change Request
Bug description:missing function to close persistent connection

Description:

PHP PDO class is missing ability to close persistent connection:
__destruct does not close it, even if I call
setAttribute(PDO::ATTR_PERSISTENT,FALSE) before destruction
May be __destruct should analyze PDO::ATTR_PERSISTENT attribute or there
should be explicit function to close persistent connection.

Need to close invalid (shutdown) peristent connection demonstrate example
below:

Example with firebird:
1. establish persistent connect in php
2. shutdown connection on server
3. try to get persistent connect from php again
there will be error "General error: -902 connection shutdown"

I can check connection validity in my pdo derived class like this:
public function isValid(){
$valid=TRUE;
try {
$this->beginTransaction();
$this->commit();
} catch (PDOException $e){
$valid=FALSE;
}
return $valid;
}

but I can not "refresh" or "close" my broken connection, there is no
function to free it in php connection pool


-- 
Edit bug report at https://bugs.php.net/bug.php?id=64603&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=64603&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=64603&r=trysnapshot53
Try a snapshot (trunk): 
https://bugs.php.net/fix.php?id=64603&r=trysnapshottrunk
Fixed in SVN:   https://bugs.php.net/fix.php?id=64603&r=fixed
Fixed in release:   https://bugs.php.net/fix.php?id=64603&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64603&r=needtrace
Need Reproduce Script:  https://bugs.php.net/fix.php?id=64603&r=needscript
Try newer version:  https://bugs.php.net/fix.php?id=64603&r=oldversion
Not developer issue:https://bugs.php.net/fix.php?id=64603&r=support
Expected behavior:  https://bugs.php.net/fix.php?id=64603&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=64603&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=64603&r=submittedtwice
register_globals:   https://bugs.php.net/fix.php?id=64603&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64603&r=php4
Daylight Savings:   https://bugs.php.net/fix.php?id=64603&r=dst
IIS Stability:  https://bugs.php.net/fix.php?id=64603&r=isapi
Install GNU Sed:https://bugs.php.net/fix.php?id=64603&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64603&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64603&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64603&r=mysqlcfg



Req #64603 [Opn]: missing function to close persistent connection

2013-04-07 Thread slavb18 at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=64603&edit=1

 ID: 64603
 User updated by:slavb18 at gmail dot com
 Reported by:slavb18 at gmail dot com
 Summary:missing function to close persistent connection
 Status: Open
 Type:   Feature/Change Request
 Package:PDO related
 Operating System:   Any
 PHP Version:5.3.23
 Block user comment: N
 Private report: N

 New Comment:

there is similiar Bug #40681 with oracle


Previous Comments:

[2013-04-07 07:11:12] slavb18 at gmail dot com

Description:

PHP PDO class is missing ability to close persistent connection:
__destruct does not close it, even if I call 
setAttribute(PDO::ATTR_PERSISTENT,FALSE) before destruction
May be __destruct should analyze PDO::ATTR_PERSISTENT attribute or there should 
be explicit function to close persistent connection.

Need to close invalid (shutdown) peristent connection demonstrate example below:

Example with firebird:
1. establish persistent connect in php
2. shutdown connection on server
3. try to get persistent connect from php again
there will be error "General error: -902 connection shutdown"

I can check connection validity in my pdo derived class like this:
public function isValid(){
$valid=TRUE;
try {
$this->beginTransaction();
$this->commit();
} catch (PDOException $e){
$valid=FALSE;
}
return $valid;
}

but I can not "refresh" or "close" my broken connection, there is no function 
to free it in php connection pool







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64603&edit=1


Req #64603 [Opn]: missing function to close persistent connection

2013-04-07 Thread slavb18 at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=64603&edit=1

 ID: 64603
 User updated by:slavb18 at gmail dot com
 Reported by:slavb18 at gmail dot com
 Summary:missing function to close persistent connection
 Status: Open
 Type:   Feature/Change Request
 Package:PDO related
 Operating System:   Any
 PHP Version:5.3.23
 Block user comment: N
 Private report: N

 New Comment:

may be there is also third way to resolve problem

1. PDO class should have function
public function isValid(){
return TRUE; // or some embedded functional like start/finish transaction ? 
dont know how it work with other drivers
}
2. derived class override & implement method isValid() (like in my example)
3. php before returning PDO class from connection pool should call isValid() 
method, and if validation the result is false, then automatically refresh 
connection


Previous Comments:

[2013-04-07 07:13:03] slavb18 at gmail dot com

there is similiar Bug #40681 with oracle


[2013-04-07 07:11:12] slavb18 at gmail dot com

Description:

PHP PDO class is missing ability to close persistent connection:
__destruct does not close it, even if I call 
setAttribute(PDO::ATTR_PERSISTENT,FALSE) before destruction
May be __destruct should analyze PDO::ATTR_PERSISTENT attribute or there should 
be explicit function to close persistent connection.

Need to close invalid (shutdown) peristent connection demonstrate example below:

Example with firebird:
1. establish persistent connect in php
2. shutdown connection on server
3. try to get persistent connect from php again
there will be error "General error: -902 connection shutdown"

I can check connection validity in my pdo derived class like this:
public function isValid(){
$valid=TRUE;
try {
$this->beginTransaction();
$this->commit();
} catch (PDOException $e){
$valid=FALSE;
}
return $valid;
}

but I can not "refresh" or "close" my broken connection, there is no function 
to free it in php connection pool







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64603&edit=1


[PHP-BUG] Bug #64937 [NEW]: Unable to run firebird "execute block", containing :xxxx

2013-05-28 Thread slavb18 at gmail dot com
From: slavb18 at gmail dot com
Operating system: 
PHP version:  5.4.15
Package:  PDO related
Bug Type: Bug
Bug description:Unable to run firebird "execute block", containing :

Description:

Unable to run firebird unparametrized "execute block", containing :

if query contains string like ":", 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 :x

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 bug report at https://bugs.php.net/bug.php?id=64937&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=64937&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=64937&r=trysnapshot53
Try a snapshot (trunk): 
https://bugs.php.net/fix.php?id=64937&r=trysnapshottrunk
Fixed in SVN:   https://bugs.php.net/fix.php?id=64937&r=fixed
Fixed in release:   https://bugs.php.net/fix.php?id=64937&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64937&r=needtrace
Need Reproduce Script:  https://bugs.php.net/fix.php?id=64937&r=needscript
Try newer version:  https://bugs.php.net/fix.php?id=64937&r=oldversion
Not developer issue:https://bugs.php.net/fix.php?id=64937&r=support
Expected behavior:  https://bugs.php.net/fix.php?id=64937&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=64937&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=64937&r=submittedtwice
register_globals:   https://bugs.php.net/fix.php?id=64937&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64937&r=php4
Daylight Savings:   https://bugs.php.net/fix.php?id=64937&r=dst
IIS Stability:  https://bugs.php.net/fix.php?id=64937&r=isapi
Install GNU Sed:https://bugs.php.net/fix.php?id=64937&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64937&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64937&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64937&r=mysqlcfg



Bug #64937 [Com]: Unable to run firebird "execute block", containing :xxxx

2013-05-28 Thread slavb18 at gmail dot com
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
 :
 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 :

if query contains string like ":", 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 :x

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


Bug #64937 [Com]: Unable to run firebird "execute block", containing :xxxx

2013-05-30 Thread slavb18 at gmail dot com
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
 :
 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 :

if query contains string like ":", 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 :x

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


Bug #64037 [Com]: Firebird return wrong value for numeric field

2013-05-30 Thread slavb18 at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=64037&edit=1

 ID: 64037
 Comment by: slavb18 at gmail dot com
 Reported by:vberko at mail dot com
 Summary:Firebird return wrong value for numeric field
 Status: Open
 Type:   Bug
 Package:PDO related
 Operating System:   Windows
 PHP Version:5.4.11
 Block user comment: N
 Private report: N

 New Comment:

may be related problem, but is not fixed by patch "around line 347"

/* procedure text

create or alter procedure TESTPROC
returns (
RES numeric(15,2))
as
begin
  /* Procedure Text */
  res=15123.23;
  suspend;
end
*/

$q="Select * from testproc";
$sth=$pdo->query($q);
$row=$sth->fetch(PDO::FETCH_ASSOC);
print_r($row);

Outputs random number, like:

Array
(
[RES] => 1396457606527.04
)


istead of

Array
(
[RES] => 15123.23
)


Previous Comments:

[2013-03-21 20:12:45] matheus at gigatron dot com dot br

Figured out the problem. It's a one character fix on firebird_statement.c, 
around line 347. 

The case when (n < f) must be (n <= f).

if (n >= 0) {
*len = slprintf(*ptr, CHAR_BUF_LEN, "%" LL_MASK 
"d.%0*" LL_MASK "d", 
n / f, -var->sqlscale, n % f);
} else if (n <= -f) {
*len = slprintf(*ptr, CHAR_BUF_LEN, "%" LL_MASK 
"d.%0*" LL_MASK "d",
n / f, -var->sqlscale, -n % f); 

 } else {
*len = slprintf(*ptr, CHAR_BUF_LEN, "-0.%0*" 
LL_MASK "d", -var->sqlscale, -n % f);
}

If needed by the developers, I'll try and make a patch available.


[2013-03-21 19:39:29] matheus at gigatron dot com dot br

This still happens on php5.5 beta1. 

Also note that any value other than "-1" (0.99, -1.01, etc) will **not** 
trigger the error.


[2013-01-21 13:18:01] vberko at mail dot com

Description:

When i store -1 value in a numeric field and i read back, i get -0.00


Test script:
---
SET SQL DIALECT 3;
SET NAMES WIN1250;
CREATE DATABASE '127.0.0.1/gds_db:C:\TEST\test2.fdb' USER 'test' PASSWORD 
'test' PAGE_SIZE = 4096 DEFAULT CHARACTER SET WIN1250;
CREATE TABLE PRICE (ID INTEGER NOT NULL, TEXT VARCHAR(10), COST NUMERIC(15, 2));
INSERT INTO PRICE (ID, TEXT, COST) VALUES (2, 'test', -1);

$db=new 
PDO("firebird:dbname=localhost:c:/TEST/test2.fdb","test","test",array());
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);   
$sql="select id,cost from price where id=2";
$q=$db->query($sql);
$ret=$q->fetchAll();
var_dump($ret);

result:
array(1) { [0]=> array(4) { ["ID"]=> string(1) "2" [0]=> string(1) "2" 
["COST"]=> string(5) "-0.00" [1]=> string(5) "-0.00" } } 

Expected result:

I get back -0.00 but the right result is -1.







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64037&edit=1


Bug #62241 [Com]: PDO_Firebird

2013-05-31 Thread slavb18 at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=62241&edit=1

 ID: 62241
 Comment by: slavb18 at gmail dot com
 Reported by:mr dot efrem at gmail dot com
 Summary:PDO_Firebird
 Status: Not a bug
 Type:   Bug
 Package:PDO related
 Operating System:   Independ
 PHP Version:5.3.13
 Block user comment: N
 Private report: N

 New Comment:

I think java-style transctions params is better way, but this requires changes 
in  pdo extension - pdo should declare functions 
setTransactionIsolation, getTransactionIsolation, setReadOnly, isReadOnly, (and 
some for wait/no wait???) - like ones in 
http://docs.oracle.com/javase/7/docs/api/java/sql/Connection.html


Previous Comments:

[2013-05-31 15:14:06] slavb18 at gmail dot com

If anybody of pdo maintainers reads this, how should we realize this functional?

1. jdbc-way
pdo extension declare constants PDO_TRANS_XXX (like commented out in file 
ext/pdo_firebird/firebird_driver.c)

and then pdo_firebird translate them into firebird transaction params

2. interbase extension way
pdo_firebird export his own constants for firebird transaction params


[2012-06-08 09:07:07] mr dot efrem at gmail dot com

Please realize this functional


[2012-06-07 17:01:19] fel...@php.net

Actually there is no way to set, and such code you have seen isn't executed at 
all, it's surrounded by '#if abies_0 ... #endif'. Probably it was a planned 
feature, but not implemented yet.


[2012-06-06 09:12:17] mr dot efrem at gmail dot com

Description:

How set isolation level and options for firebird transactions?

Test script:
---
I see in ext/pdo_firebird/firebird_driver.c this code:

/* called by PDO to start a transaction */  

static int firebird_handle_begin(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
    
  
if (dbh->transaction_flags & PDO_TRANS_ISOLATION_LEVEL) {   
 
if (dbh->transaction_flags & PDO_TRANS_READ_UNCOMMITTED) {  
 
/* this is a poor fit, but it's all we have */  
 
*ptpb++ = isc_tpb_read_committed;   
 
*ptpb++ = isc_tpb_rec_version;  
 
...


How and where to send the flags PDO_TRANS_READ_COMMITTED, PDO_TRANS_READWRITE, 
PDO_TRANS_ABORT, ... at the opening of the transaction functions PDO?








-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62241&edit=1


Bug #62241 [Com]: PDO_Firebird

2013-05-31 Thread slavb18 at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=62241&edit=1

 ID: 62241
 Comment by: slavb18 at gmail dot com
 Reported by:mr dot efrem at gmail dot com
 Summary:PDO_Firebird
 Status: Not a bug
 Type:   Bug
 Package:PDO related
 Operating System:   Independ
 PHP Version:5.3.13
 Block user comment: N
 Private report: N

 New Comment:

If anybody of pdo maintainers reads this, how should we realize this functional?

1. jdbc-way
pdo extension declare constants PDO_TRANS_XXX (like commented out in file 
ext/pdo_firebird/firebird_driver.c)

and then pdo_firebird translate them into firebird transaction params

2. interbase extension way
pdo_firebird export his own constants for firebird transaction params


Previous Comments:

[2012-06-08 09:07:07] mr dot efrem at gmail dot com

Please realize this functional


[2012-06-07 17:01:19] fel...@php.net

Actually there is no way to set, and such code you have seen isn't executed at 
all, it's surrounded by '#if abies_0 ... #endif'. Probably it was a planned 
feature, but not implemented yet.


[2012-06-06 09:12:17] mr dot efrem at gmail dot com

Description:

How set isolation level and options for firebird transactions?

Test script:
---
I see in ext/pdo_firebird/firebird_driver.c this code:

/* called by PDO to start a transaction */  

static int firebird_handle_begin(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
    
  
if (dbh->transaction_flags & PDO_TRANS_ISOLATION_LEVEL) {   
 
if (dbh->transaction_flags & PDO_TRANS_READ_UNCOMMITTED) {  
 
/* this is a poor fit, but it's all we have */  
 
*ptpb++ = isc_tpb_read_committed;   
 
*ptpb++ = isc_tpb_rec_version;  
 
...


How and where to send the flags PDO_TRANS_READ_COMMITTED, PDO_TRANS_READWRITE, 
PDO_TRANS_ABORT, ... at the opening of the transaction functions PDO?








-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62241&edit=1