mirror of
https://github.com/dg/dibi.git
synced 2025-08-04 13:17:58 +02:00
DibiResult destructor moved to individual IDibiResultDriver drivers
This commit is contained in:
@@ -354,6 +354,17 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically frees the resources allocated for this result set.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __destruct()
|
||||||
|
{
|
||||||
|
$this->resultSet && @$this->free();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of rows in a result set.
|
* Returns the number of rows in a result set.
|
||||||
* @return int
|
* @return int
|
||||||
@@ -460,7 +471,6 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
|
|||||||
'view' => $row[1] === 'TRUE',
|
'view' => $row[1] === 'TRUE',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $tables;
|
return $tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,7 +527,6 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
|
|||||||
'autoincrement' => FALSE,
|
'autoincrement' => FALSE,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $columns;
|
return $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -553,7 +562,6 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
|
|||||||
$indexes[$key]['table'] = $table;
|
$indexes[$key]['table'] = $table;
|
||||||
$indexes[$key]['columns'][$row['FIELD_POSITION']] = $row['FIELD_NAME'];
|
$indexes[$key]['columns'][$row['FIELD_POSITION']] = $row['FIELD_NAME'];
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $indexes;
|
return $indexes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -585,7 +593,6 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
|
|||||||
'table' => $table,
|
'table' => $table,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $keys;
|
return $keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -609,7 +616,6 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
|
|||||||
while ($row = $res->fetch(FALSE)) {
|
while ($row = $res->fetch(FALSE)) {
|
||||||
$indices[] = $row[0];
|
$indices[] = $row[0];
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $indices;
|
return $indices;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -635,7 +641,6 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
|
|||||||
while ($row = $res->fetch(FALSE)) {
|
while ($row = $res->fetch(FALSE)) {
|
||||||
$constraints[] = $row[0];
|
$constraints[] = $row[0];
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $constraints;
|
return $constraints;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -686,7 +691,6 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
|
|||||||
'enabled' => trim($row['TRIGGER_ENABLED']) === 'TRUE',
|
'enabled' => trim($row['TRIGGER_ENABLED']) === 'TRUE',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $triggers;
|
return $triggers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -710,7 +714,6 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
|
|||||||
while ($row = $res->fetch(FALSE)) {
|
while ($row = $res->fetch(FALSE)) {
|
||||||
$triggers[] = $row[0];
|
$triggers[] = $row[0];
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $triggers;
|
return $triggers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -765,7 +768,6 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
|
|||||||
$procedures[$key]['params'][$io][$num]['type'] = trim($row['FIELD_TYPE']);
|
$procedures[$key]['params'][$io][$num]['type'] = trim($row['FIELD_TYPE']);
|
||||||
$procedures[$key]['params'][$io][$num]['size'] = $row['FIELD_LENGTH'];
|
$procedures[$key]['params'][$io][$num]['size'] = $row['FIELD_LENGTH'];
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $procedures;
|
return $procedures;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -785,7 +787,6 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
|
|||||||
while ($row = $res->fetch(FALSE)) {
|
while ($row = $res->fetch(FALSE)) {
|
||||||
$procedures[] = $row[0];
|
$procedures[] = $row[0];
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $procedures;
|
return $procedures;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -806,7 +807,6 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
|
|||||||
while ($row = $res->fetch(FALSE)) {
|
while ($row = $res->fetch(FALSE)) {
|
||||||
$generators[] = $row[0];
|
$generators[] = $row[0];
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $generators;
|
return $generators;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -827,7 +827,6 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
|
|||||||
while ($row = $res->fetch(FALSE)) {
|
while ($row = $res->fetch(FALSE)) {
|
||||||
$functions[] = $row[0];
|
$functions[] = $row[0];
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $functions;
|
return $functions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -301,6 +301,17 @@ class DibiMsSqlDriver extends DibiObject implements IDibiDriver, IDibiResultDriv
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically frees the resources allocated for this result set.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __destruct()
|
||||||
|
{
|
||||||
|
$this->resultSet && @$this->free();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of rows in a result set.
|
* Returns the number of rows in a result set.
|
||||||
* @return int
|
* @return int
|
||||||
|
@@ -308,6 +308,17 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically frees the resources allocated for this result set.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __destruct()
|
||||||
|
{
|
||||||
|
$this->resultSet && @$this->free();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of rows in a result set.
|
* Returns the number of rows in a result set.
|
||||||
* @return int
|
* @return int
|
||||||
|
@@ -379,6 +379,17 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver, IDibiResultDriv
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically frees the resources allocated for this result set.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __destruct()
|
||||||
|
{
|
||||||
|
$this->resultSet && @$this->free();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of rows in a result set.
|
* Returns the number of rows in a result set.
|
||||||
* @return int
|
* @return int
|
||||||
|
@@ -51,7 +51,6 @@ class DibiMySqlReflector extends DibiObject implements IDibiReflector
|
|||||||
'view' => isset($row[1]) && $row[1] === 'VIEW',
|
'view' => isset($row[1]) && $row[1] === 'VIEW',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $tables;
|
return $tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +85,6 @@ class DibiMySqlReflector extends DibiObject implements IDibiReflector
|
|||||||
'vendor' => $row,
|
'vendor' => $row,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $columns;
|
return $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +112,6 @@ class DibiMySqlReflector extends DibiObject implements IDibiReflector
|
|||||||
$indexes[$row['Key_name']]['primary'] = $row['Key_name'] === 'PRIMARY';
|
$indexes[$row['Key_name']]['primary'] = $row['Key_name'] === 'PRIMARY';
|
||||||
$indexes[$row['Key_name']]['columns'][$row['Seq_in_index'] - 1] = $row['Column_name'];
|
$indexes[$row['Key_name']]['columns'][$row['Seq_in_index'] - 1] = $row['Column_name'];
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return array_values($indexes);
|
return array_values($indexes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -375,6 +375,17 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiResultDri
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically frees the resources allocated for this result set.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __destruct()
|
||||||
|
{
|
||||||
|
$this->resultSet && @$this->free();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of rows in a result set.
|
* Returns the number of rows in a result set.
|
||||||
* @return int
|
* @return int
|
||||||
|
@@ -322,6 +322,17 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver, IDibiResultDrive
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically frees the resources allocated for this result set.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __destruct()
|
||||||
|
{
|
||||||
|
$this->resultSet && @$this->free();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of rows in a result set.
|
* Returns the number of rows in a result set.
|
||||||
* @return int
|
* @return int
|
||||||
|
@@ -314,6 +314,17 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically frees the resources allocated for this result set.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __destruct()
|
||||||
|
{
|
||||||
|
$this->resultSet && @$this->free();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of rows in a result set.
|
* Returns the number of rows in a result set.
|
||||||
* @return int
|
* @return int
|
||||||
@@ -413,7 +424,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $tables;
|
return $tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -171,7 +171,6 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver, IDibiResultDr
|
|||||||
if (!$res) return FALSE;
|
if (!$res) return FALSE;
|
||||||
|
|
||||||
$row = $res->fetch(FALSE);
|
$row = $res->fetch(FALSE);
|
||||||
$res->free();
|
|
||||||
return is_array($row) ? $row[0] : FALSE;
|
return is_array($row) ? $row[0] : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,6 +362,17 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver, IDibiResultDr
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically frees the resources allocated for this result set.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __destruct()
|
||||||
|
{
|
||||||
|
$this->resultSet && @$this->free();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of rows in a result set.
|
* Returns the number of rows in a result set.
|
||||||
* @return int
|
* @return int
|
||||||
@@ -465,7 +475,6 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver, IDibiResultDr
|
|||||||
WHERE table_schema = current_schema()
|
WHERE table_schema = current_schema()
|
||||||
");
|
");
|
||||||
$tables = pg_fetch_all($res->resultSet);
|
$tables = pg_fetch_all($res->resultSet);
|
||||||
$res->free();
|
|
||||||
return $tables ? $tables : array();
|
return $tables ? $tables : array();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,7 +516,6 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver, IDibiResultDr
|
|||||||
'vendor' => $row,
|
'vendor' => $row,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $columns;
|
return $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -550,7 +558,6 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver, IDibiResultDr
|
|||||||
$indexes[$row['relname']]['columns'][] = $columns[$index];
|
$indexes[$row['relname']]['columns'][] = $columns[$index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return array_values($indexes);
|
return array_values($indexes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -48,7 +48,6 @@ class DibiSqliteReflector extends DibiObject implements IDibiReflector
|
|||||||
while ($row = $res->fetch(TRUE)) {
|
while ($row = $res->fetch(TRUE)) {
|
||||||
$tables[] = $row;
|
$tables[] = $row;
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $tables;
|
return $tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +84,6 @@ class DibiSqliteReflector extends DibiObject implements IDibiReflector
|
|||||||
'vendor' => $row,
|
'vendor' => $row,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return $columns;
|
return $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,14 +102,12 @@ class DibiSqliteReflector extends DibiObject implements IDibiReflector
|
|||||||
$indexes[$row['name']]['name'] = $row['name'];
|
$indexes[$row['name']]['name'] = $row['name'];
|
||||||
$indexes[$row['name']]['unique'] = (bool) $row['unique'];
|
$indexes[$row['name']]['unique'] = (bool) $row['unique'];
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
|
|
||||||
foreach ($indexes as $index => $values) {
|
foreach ($indexes as $index => $values) {
|
||||||
$res = $this->driver->query("PRAGMA index_info([$index])");
|
$res = $this->driver->query("PRAGMA index_info([$index])");
|
||||||
while ($row = $res->fetch(TRUE)) {
|
while ($row = $res->fetch(TRUE)) {
|
||||||
$indexes[$index]['columns'][$row['seqno']] = $row['name'];
|
$indexes[$index]['columns'][$row['seqno']] = $row['name'];
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$columns = $this->getColumns($table);
|
$columns = $this->getColumns($table);
|
||||||
@@ -169,7 +165,6 @@ class DibiSqliteReflector extends DibiObject implements IDibiReflector
|
|||||||
$keys[$row['id']]['foreign'] = NULL;
|
$keys[$row['id']]['foreign'] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$res->free();
|
|
||||||
return array_values($keys);
|
return array_values($keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -312,6 +312,17 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically frees the resources allocated for this result set.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __destruct()
|
||||||
|
{
|
||||||
|
$this->resultSet && @$this->free();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of rows in a result set.
|
* Returns the number of rows in a result set.
|
||||||
* @return int
|
* @return int
|
||||||
|
@@ -78,17 +78,6 @@ class DibiResult extends DibiObject implements IDataSource
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Automatically frees the resources allocated for this result set.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __destruct()
|
|
||||||
{
|
|
||||||
@$this->free(); // intentionally @
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the result set resource.
|
* Returns the result set resource.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
Reference in New Issue
Block a user