1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-06 14:16:39 +02:00

* new: qualifiy each column name with the table name using DibiResult::setWithTables

* removed DibiResult::setType(TRUE) with autodetection
* removed DibiResult::getFields() & getMetaData() in favour of new method getColumnsMeta()
* MySQLi and MySQL transaction implementation are the same
* better escaping in DibiPostgreDriver (new pg_escape_string and addslashes)
This commit is contained in:
David Grudl
2007-11-30 10:12:45 +00:00
parent 1aad1c8da9
commit cbd37021f2
15 changed files with 313 additions and 353 deletions

View File

@@ -255,11 +255,12 @@ class DibiSqliteDriver extends NObject implements DibiDriverInterface
* Fetches the row at current position and moves the internal cursor to the next position
* internal usage only
*
* @return array|FALSE array on success, FALSE if no next record
* @param bool TRUE for associative array, FALSE for numeric
* @return array array on success, nonarray if no next record
*/
public function fetch()
public function fetch($type)
{
return sqlite_fetch_array($this->resultset, SQLITE_ASSOC);
return sqlite_fetch_array($this->resultset, $type ? SQLITE_ASSOC : SQLITE_NUM);
}
@@ -293,14 +294,21 @@ class DibiSqliteDriver extends NObject implements DibiDriverInterface
/** this is experimental */
public function buildMeta()
/**
* Returns metadata for all columns in a result set
*
* @return array
*/
public function getColumnsMeta()
{
$count = sqlite_num_fields($this->resultset);
$meta = array();
for ($index = 0; $index < $count; $index++) {
$name = sqlite_field_name($this->resultset, $index);
$meta[$name] = array('type' => dibi::FIELD_UNKNOWN);
for ($i = 0; $i < $count; $i++) {
// items 'name' and 'table' are required
$meta[] = array(
'name' => sqlite_field_name($this->resultset, $i),
'table' => NULL,
);
}
return $meta;
}