Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Ajustment SequenceFeature generic drivers #3912

Closed
wants to merge 2 commits into from

2 participants

@romulobusatto

Changed of ->getResource()->fetch(\PDO::FETCH_ASSOC) to ->current(), generic to all Drivers

romulobusatto added some commits
@romulobusatto romulobusatto Update library/Zend/Db/TableGateway/Feature/SequenceFeature.php
Changed of ->getResource()->fetch(\PDO::FETCH_ASSOC) to ->current(), generic to all Drivers
95ec624
@romulobusatto romulobusatto Update library/Zend/Db/Adapter/Driver/Pdo/Statement.php
When you use Oracle, and table with CLOB columns, through CActiveRecord, everything works well till You'll try to save to column string greater than 4000 chars.
When string is 4k+ chars You'll get OCI exception, I've tried forcing the PDO::PARAM_LOB within COciCommandBuilder but with no luck, PARAM_LOB is still not working with oci, but there is a work around.
Researching, I discovered that passing the string size, I save more than 4000 characters in a field clob. 
Tested and worked!
952ad65
@ralphschindler
Collaborator

Could you remove the commit that changes the Pdo\Statement.php? I dont think that has much to do with the SequenceFeature change.

@ralphschindler ralphschindler referenced this pull request from a commit in ralphschindler/zf2
@ralphschindler ralphschindler A Better fix for #3912 ebf72f8
@weierophinney weierophinney closed this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/3912'
Close #4240
Fixes #3912
879f46f
@ghost Unknown referenced this pull request from a commit
@ralphschindler ralphschindler A Better fix for #3912 8fd9406
@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/3912'
Close #4240
Fixes #3912
1913f89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 27, 2013
  1. @romulobusatto

    Update library/Zend/Db/TableGateway/Feature/SequenceFeature.php

    romulobusatto authored
    Changed of ->getResource()->fetch(\PDO::FETCH_ASSOC) to ->current(), generic to all Drivers
  2. @romulobusatto

    Update library/Zend/Db/Adapter/Driver/Pdo/Statement.php

    romulobusatto authored
    When you use Oracle, and table with CLOB columns, through CActiveRecord, everything works well till You'll try to save to column string greater than 4000 chars.
    When string is 4k+ chars You'll get OCI exception, I've tried forcing the PDO::PARAM_LOB within COciCommandBuilder but with no luck, PARAM_LOB is still not working with oci, but there is a work around.
    Researching, I discovered that passing the string size, I save more than 4000 characters in a field clob. 
    Tested and worked!
This page is out of date. Refresh to see the latest.
View
5 library/Zend/Db/Adapter/Driver/Pdo/Statement.php
@@ -284,7 +284,10 @@ protected function bindParametersFromContainer()
// parameter is named or positional, value is reference
$parameter = is_int($name) ? ($name + 1) : $name;
- $this->resource->bindParam($parameter, $value, $type);
+ if($type == \PDO::PARAM_STR)
+ $this->resource->bindParam($parameter, $value, $type, strlen($value));
+ else
+ $this->resource->bindParam($parameter, $value, $type);
}
}
View
4 library/Zend/Db/TableGateway/Feature/SequenceFeature.php
@@ -92,7 +92,7 @@ public function nextSequenceId()
$statement = $this->tableGateway->adapter->createStatement();
$statement->prepare($sql);
$result = $statement->execute();
- $sequence = $result->getResource()->fetch(\PDO::FETCH_ASSOC);
+ $sequence = $result->current();
unset($statement, $result);
return $sequence['nextval'];
}
@@ -121,7 +121,7 @@ public function lastSequenceId()
$statement = $this->tableGateway->adapter->createStatement();
$statement->prepare($sql);
$result = $statement->execute();
- $sequence = $result->getResource()->fetch(\PDO::FETCH_ASSOC);
+ $sequence = $result->current();
unset($statement, $result);
return $sequence['currval'];
}
Something went wrong with that request. Please try again.