1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-18 11:51:18 +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

@@ -249,11 +249,12 @@ class DibiOracleDriver 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 oci_fetch_assoc($this->resultset);
return oci_fetch_array($this->resultset, ($type ? OCI_ASSOC : OCI_NUM) | OCI_RETURN_NULLS);
}
@@ -285,14 +286,25 @@ class DibiOracleDriver 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 = oci_num_fields($this->resultset);
$meta = array();
for ($index = 0; $index < $count; $index++) {
$name = oci_field_name($this->resultset, $index + 1);
$meta[$name] = array('type' => dibi::FIELD_UNKNOWN);
for ($i = 1; $i <= $count; $i++) {
// items 'name' and 'table' are required
$meta[] = array(
'name' => oci_field_name($this->resultset, $i),
'table' => NULL,
'type' => 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),
);
}
return $meta;
}