mirror of
https://github.com/dg/dibi.git
synced 2025-08-11 16:44:30 +02:00
- implemented basic meta/reflection support
This commit is contained in:
@@ -185,6 +185,22 @@ class DibiMsSqlDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* SQL ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Encodes data for use in an SQL statement.
|
||||
*
|
||||
@@ -258,6 +274,10 @@ class DibiMsSqlDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/********************* result set ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows in a result set.
|
||||
*
|
||||
@@ -324,6 +344,7 @@ class DibiMsSqlDriver extends DibiObject implements IDibiDriver
|
||||
// items 'name' and 'table' are required
|
||||
$info = (array) mssql_fetch_field($this->resultSet, $i);
|
||||
$info['table'] = $info['column_source'];
|
||||
$info['nativetype'] = $info['type'];
|
||||
$meta[] = $info;
|
||||
}
|
||||
return $meta;
|
||||
@@ -331,18 +352,6 @@ class DibiMsSqlDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the result set resource.
|
||||
*
|
||||
@@ -355,12 +364,53 @@ class DibiMsSqlDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/********************* reflection ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets a information of the current database.
|
||||
*
|
||||
* @return DibiReflection
|
||||
* Returns list of tables.
|
||||
* @return array
|
||||
*/
|
||||
function getDibiReflection()
|
||||
{}
|
||||
public function getTables()
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all columns in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getColumns($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all indexes in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getIndexes($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all foreign keys in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getForeignKeys($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -247,6 +247,22 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* SQL ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Encodes data for use in an SQL statement.
|
||||
*
|
||||
@@ -317,6 +333,10 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/********************* result set ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows in a result set.
|
||||
*
|
||||
@@ -387,26 +407,15 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver
|
||||
$count = mysql_num_fields($this->resultSet);
|
||||
$meta = array();
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
// items 'name' and 'table' are required
|
||||
$meta[] = (array) mysql_fetch_field($this->resultSet, $i);
|
||||
$info = (array) mysql_fetch_field($this->resultSet, $i);
|
||||
$info['nativetype'] = $info['type'];
|
||||
$meta[] = $info;
|
||||
}
|
||||
return $meta;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the result set resource.
|
||||
*
|
||||
@@ -419,12 +428,59 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/********************* reflection ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets a information of the current database.
|
||||
*
|
||||
* @return DibiReflection
|
||||
* Returns list of tables.
|
||||
* @return array
|
||||
*/
|
||||
function getDibiReflection()
|
||||
{}
|
||||
public function getTables()
|
||||
{
|
||||
$this->query("SHOW TABLES");
|
||||
$res = array();
|
||||
while ($row = mysql_fetch_array($this->resultSet, MYSQL_NUM)) {
|
||||
$res[] = array('name' => $row[0]);
|
||||
}
|
||||
$this->free();
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all columns in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getColumns($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all indexes in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getIndexes($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all foreign keys in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getForeignKeys($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -231,6 +231,22 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
*
|
||||
* @return mysqli
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* SQL ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Encodes data for use in an SQL statement.
|
||||
*
|
||||
@@ -300,6 +316,10 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/********************* result set ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows in a result set.
|
||||
*
|
||||
@@ -370,25 +390,15 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver
|
||||
$meta = array();
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
// items 'name' and 'table' are required
|
||||
$meta[] = (array) mysqli_fetch_field_direct($this->resultSet, $i);
|
||||
$info = (array) mysqli_fetch_field_direct($this->resultSet, $i);
|
||||
$info['nativetype'] = $info['type'];
|
||||
$meta[] = $info;
|
||||
}
|
||||
return $meta;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
*
|
||||
* @return mysqli
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the result set resource.
|
||||
*
|
||||
@@ -401,12 +411,59 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/********************* reflection ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets a information of the current database.
|
||||
*
|
||||
* @return DibiReflection
|
||||
* Returns list of tables.
|
||||
* @return array
|
||||
*/
|
||||
function getDibiReflection()
|
||||
{}
|
||||
public function getTables()
|
||||
{
|
||||
$this->query("SHOW TABLES");
|
||||
$res = array();
|
||||
while ($row = mysqli_fetch_array($this->resultSet, MYSQLI_NUM)) {
|
||||
$res[] = array('name' => $row[0]);
|
||||
}
|
||||
$this->free();
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all columns in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getColumns($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all indexes in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getIndexes($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all foreign keys in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getForeignKeys($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -199,6 +199,22 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* SQL ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Encodes data for use in an SQL statement.
|
||||
*
|
||||
@@ -269,6 +285,10 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/********************* result set ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows in a result set.
|
||||
*
|
||||
@@ -347,7 +367,7 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver
|
||||
$meta[] = array(
|
||||
'name' => odbc_field_name($this->resultSet, $i),
|
||||
'table' => NULL,
|
||||
'type' => odbc_field_type($this->resultSet, $i),
|
||||
'nativetype'=> odbc_field_type($this->resultSet, $i),
|
||||
'length' => odbc_field_len($this->resultSet, $i),
|
||||
'scale' => odbc_field_scale($this->resultSet, $i),
|
||||
'precision' => odbc_field_precision($this->resultSet, $i),
|
||||
@@ -358,18 +378,6 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the result set resource.
|
||||
*
|
||||
@@ -382,12 +390,58 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/********************* reflection ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets a information of the current database.
|
||||
*
|
||||
* @return DibiReflection
|
||||
* Returns list of tables.
|
||||
* @return array
|
||||
*/
|
||||
function getDibiReflection()
|
||||
{}
|
||||
public function getTables()
|
||||
{
|
||||
$result = odbc_tables($this->connection);
|
||||
$res = array();
|
||||
while (odbc_fetch_row($result)) {
|
||||
$res[] = array('name' => odbc_result($result, 'TABLE_NAME'));
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all columns in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getColumns($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all indexes in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getIndexes($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all foreign keys in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getForeignKeys($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -199,6 +199,22 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* SQL ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Encodes data for use in an SQL statement.
|
||||
*
|
||||
@@ -266,6 +282,10 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/********************* result set ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows in a result set.
|
||||
*
|
||||
@@ -333,7 +353,7 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver
|
||||
$meta[] = array(
|
||||
'name' => oci_field_name($this->resultSet, $i),
|
||||
'table' => NULL,
|
||||
'type' => oci_field_type($this->resultSet, $i),
|
||||
'nativetype'=> oci_field_type($this->resultSet, $i),
|
||||
'size' => oci_field_size($this->resultSet, $i),
|
||||
'scale' => oci_field_scale($this->resultSet, $i),
|
||||
'precision' => oci_field_precision($this->resultSet, $i),
|
||||
@@ -344,18 +364,6 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the result set resource.
|
||||
*
|
||||
@@ -368,12 +376,53 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/********************* reflection ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets a information of the current database.
|
||||
*
|
||||
* @return DibiReflection
|
||||
* Returns list of tables.
|
||||
* @return array
|
||||
*/
|
||||
function getDibiReflection()
|
||||
{}
|
||||
public function getTables()
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all columns in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getColumns($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all indexes in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getIndexes($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all foreign keys in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getForeignKeys($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -222,6 +222,22 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
*
|
||||
* @return PDO
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* SQL ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Encodes data for use in an SQL statement.
|
||||
*
|
||||
@@ -312,6 +328,10 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/********************* result set ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows in a result set.
|
||||
*
|
||||
@@ -380,6 +400,7 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver
|
||||
if ($info === FALSE) {
|
||||
throw new DibiDriverException('Driver does not support meta data.');
|
||||
}
|
||||
$info['nativetype'] = $info['native_type'];
|
||||
$meta[] = $info;
|
||||
}
|
||||
return $meta;
|
||||
@@ -387,18 +408,6 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
*
|
||||
* @return PDO
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the result set resource.
|
||||
*
|
||||
@@ -411,12 +420,53 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/********************* reflection ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets a information of the current database.
|
||||
*
|
||||
* @return DibiReflection
|
||||
* Returns list of tables.
|
||||
* @return array
|
||||
*/
|
||||
function getDibiReflection()
|
||||
{}
|
||||
public function getTables()
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all columns in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getColumns($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all indexes in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getIndexes($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all foreign keys in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getForeignKeys($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -223,6 +223,22 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* SQL ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Encodes data for use in an SQL statement.
|
||||
*
|
||||
@@ -314,6 +330,10 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/********************* result set ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows in a result set.
|
||||
*
|
||||
@@ -382,7 +402,7 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver
|
||||
$meta[] = array(
|
||||
'name' => pg_field_name($this->resultSet, $i),
|
||||
'table' => $hasTable ? pg_field_table($this->resultSet, $i) : NULL,
|
||||
'type' => pg_field_type($this->resultSet, $i),
|
||||
'nativetype'=> pg_field_type($this->resultSet, $i),
|
||||
'size' => pg_field_size($this->resultSet, $i),
|
||||
'prtlen' => pg_field_prtlen($this->resultSet, $i),
|
||||
);
|
||||
@@ -392,18 +412,6 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the result set resource.
|
||||
*
|
||||
@@ -416,12 +424,53 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/********************* reflection ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets a information of the current database.
|
||||
*
|
||||
* @return DibiReflection
|
||||
* Returns list of tables.
|
||||
* @return array
|
||||
*/
|
||||
function getDibiReflection()
|
||||
{}
|
||||
public function getTables()
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all columns in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getColumns($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all indexes in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getIndexes($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all foreign keys in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getForeignKeys($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -202,6 +202,22 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************* SQL ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Encodes data for use in an SQL statement.
|
||||
*
|
||||
@@ -267,6 +283,10 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/********************* result set ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of rows in a result set.
|
||||
*
|
||||
@@ -335,10 +355,13 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver
|
||||
$count = sqlite_num_fields($this->resultSet);
|
||||
$meta = array();
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
// items 'name' and 'table' are required
|
||||
$pair = explode('.', sqlite_field_name($this->resultSet, $i));
|
||||
if (!isset($pair[1])) {
|
||||
array_unshift($pair, NULL);
|
||||
}
|
||||
$meta[] = array(
|
||||
'name' => sqlite_field_name($this->resultSet, $i),
|
||||
'table' => NULL,
|
||||
'name' => $pair[1],
|
||||
'table' => $pair[0],
|
||||
);
|
||||
}
|
||||
return $meta;
|
||||
@@ -346,18 +369,6 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResource()
|
||||
{
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the result set resource.
|
||||
*
|
||||
@@ -370,12 +381,57 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/********************* reflection ****************d*g**/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets a information of the current database.
|
||||
*
|
||||
* @return DibiReflection
|
||||
* Returns list of tables.
|
||||
* @return array
|
||||
*/
|
||||
function getDibiReflection()
|
||||
{}
|
||||
public function getTables()
|
||||
{
|
||||
$this->query("
|
||||
SELECT name FROM sqlite_master WHERE type='table'
|
||||
UNION ALL SELECT name FROM sqlite_temp_master WHERE type='table' ORDER BY name
|
||||
");
|
||||
return sqlite_fetch_all($this->resultSet, SQLITE_ASSOC);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all columns in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getColumns($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all indexes in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getIndexes($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all foreign keys in a table.
|
||||
* @param string
|
||||
* @return array
|
||||
*/
|
||||
public function getForeignKeys($table)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user