return ' ';
} else if (is_bool($value)) {
return (int)$value;
- } else if (is_null($value)) {
- return '';
} else {
return $value;
}
return ' ';
} else if (is_bool($value)) {
return (int)$value;
- } else if (is_null($value)) {
- return '';
} else {
return $value;
}
} else if (gettype($value) == 'integer') {
return '0'; // Transform 0 to '0' that evaluates the same for PHP
- } else if (is_null($value)) {
- return '';
-
} else if ($value === '') {
return ' '; // Transform '' to ' ' that DON'T EVALUATE THE SAME
// (we'll transform back again on get_records_XXX functions and others)!!
return true;
}
- protected function bind_params($stmt, array & $params=null, $tablename=null, array & $descriptors = null) {
+ protected function bind_params($stmt, array &$params=null, $tablename=null, array &$descriptors = null) {
if ($params) {
$columns = array();
if ($tablename) {
default: // Bind as CHAR (applying dirty hack)
// TODO: Optimise
$params[$key] = $this->oracle_dirty_hack($tablename, $columnname, $params[$key]);
+ // Because of PHP7 bug (https://bugs.php.net/bug.php?id=72524) it seems that it's
+ // impossible to bind NULL values in a reliable way, let's use empty string
+ // instead in the mean time.
+ if ($params[$key] === null && version_compare(PHP_VERSION, '7.0.0', '>=')) {
+ $params[$key] = '';
+ }
oci_bind_by_name($stmt, $key, $params[$key]);
}
}
protected function free_descriptors($descriptors) {
foreach ($descriptors as $descriptor) {
+ // Because all descriptors used in the driver come from LOB::writeTemporary() calls
+ // we can safely close them here unconditionally.
$descriptor->close();
+ // Free resources.
oci_free_descriptor($descriptor);
}
}
list($sql, $params) = $this->tweak_param_names($sql, $params);
$this->query_start($sql, $params, SQL_QUERY_UPDATE);
$stmt = $this->parse_query($sql);
- $descriptors = [];
+ $descriptors = array();
$this->bind_params($stmt, $params, null, $descriptors);
$result = oci_execute($stmt, $this->commit_status);
$this->free_descriptors($descriptors);
list($rawsql, $params) = $this->tweak_param_names($rawsql, $params);
$this->query_start($rawsql, $params, SQL_QUERY_SELECT);
$stmt = $this->parse_query($rawsql);
- $descriptors = [];
+ $descriptors = array();
$this->bind_params($stmt, $params, null, $descriptors);
$result = oci_execute($stmt, $this->commit_status);
$this->free_descriptors($descriptors);
list($rawsql, $params) = $this->tweak_param_names($rawsql, $params);
$this->query_start($rawsql, $params, SQL_QUERY_SELECT);
$stmt = $this->parse_query($rawsql);
- $descriptors = [];
+ $descriptors = array();
$this->bind_params($stmt, $params, null, $descriptors);
$result = oci_execute($stmt, $this->commit_status);
$this->free_descriptors($descriptors);
list($sql, $params) = $this->tweak_param_names($sql, $params);
$this->query_start($sql, $params, SQL_QUERY_SELECT);
$stmt = $this->parse_query($sql);
- $descriptors = [];
+ $descriptors = array();
$this->bind_params($stmt, $params, null, $descriptors);
$result = oci_execute($stmt, $this->commit_status);
$this->free_descriptors($descriptors);
if ($returning) {
oci_bind_by_name($stmt, ":oracle_id", $id, 10, SQLT_INT);
}
- $descriptors = [];
+ $descriptors = array();
$this->bind_params($stmt, $params, $table, $descriptors);
$result = oci_execute($stmt, $this->commit_status);
$this->free_descriptors($descriptors);
// list($sql, $params) = $this->tweak_param_names($sql, $params);
$this->query_start($sql, $params, SQL_QUERY_UPDATE);
$stmt = $this->parse_query($sql);
- $descriptors = [];
+ $descriptors = array();
$this->bind_params($stmt, $params, $table, $descriptors);
$result = oci_execute($stmt, $this->commit_status);
$this->free_descriptors($descriptors);
list($sql, $params) = $this->tweak_param_names($sql, $params);
$this->query_start($sql, $params, SQL_QUERY_UPDATE);
$stmt = $this->parse_query($sql);
- $descriptors = [];
+ $descriptors = array();
$this->bind_params($stmt, $params, $table, $descriptors);
$result = oci_execute($stmt, $this->commit_status);
$this->free_descriptors($descriptors);
list($sql, $params) = $this->tweak_param_names($sql, $params);
$this->query_start($sql, $params, SQL_QUERY_UPDATE);
$stmt = $this->parse_query($sql);
- $descriptors = [];
+ $descriptors = array();
$this->bind_params($stmt, $params, null, $descriptors);
$result = oci_execute($stmt, $this->commit_status);
$this->free_descriptors($descriptors);