mirror of
https://github.com/dg/dibi.git
synced 2025-08-16 11:04:43 +02:00
- DibiTranslator: empty arrays generate NULL (it may cause an BC break!)
- Dibi: disables magic_quotes_runtime
This commit is contained in:
@@ -260,7 +260,7 @@ final class DibiTranslator extends DibiObject
|
||||
$pair = explode('%', $k, 2); // split into identifier & modifier
|
||||
$vx[] = $this->formatValue($v, isset($pair[1]) ? $pair[1] : FALSE);
|
||||
}
|
||||
return '(' . implode(', ', $vx) . ')';
|
||||
return '(' . ($vx ? implode(', ', $vx) : 'NULL') . ')';
|
||||
|
||||
|
||||
case 'v': // (key, key, ...) VALUES (val, val, ...)
|
||||
@@ -291,7 +291,7 @@ final class DibiTranslator extends DibiObject
|
||||
foreach ($value as $v) {
|
||||
$vx[] = $this->formatValue($v, $modifier);
|
||||
}
|
||||
return implode(', ', $vx);
|
||||
return $vx ? implode(', ', $vx) : 'NULL';
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -122,8 +122,6 @@ interface IDibiDriver
|
||||
*/
|
||||
function connect(array &$config);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Disconnects from a database.
|
||||
* @return void
|
||||
@@ -131,8 +129,6 @@ interface IDibiDriver
|
||||
*/
|
||||
function disconnect();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Internal: Executes the SQL query.
|
||||
* @param string SQL statement.
|
||||
@@ -141,24 +137,18 @@ interface IDibiDriver
|
||||
*/
|
||||
function query($sql);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.
|
||||
* @return int|FALSE number of rows or FALSE on error
|
||||
*/
|
||||
function getAffectedRows();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.
|
||||
* @return int|FALSE int on success or FALSE on failure
|
||||
*/
|
||||
function getInsertId($sequence);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Begins a transaction (if supported).
|
||||
* @param string optinal savepoint name
|
||||
@@ -167,8 +157,6 @@ interface IDibiDriver
|
||||
*/
|
||||
function begin($savepoint = NULL);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Commits statements in a transaction.
|
||||
* @param string optinal savepoint name
|
||||
@@ -177,8 +165,6 @@ interface IDibiDriver
|
||||
*/
|
||||
function commit($savepoint = NULL);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Rollback changes in a transaction.
|
||||
* @param string optinal savepoint name
|
||||
@@ -187,8 +173,6 @@ interface IDibiDriver
|
||||
*/
|
||||
function rollback($savepoint = NULL);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
* @return mixed
|
||||
@@ -210,8 +194,6 @@ interface IDibiDriver
|
||||
*/
|
||||
function escape($value, $type);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Decodes data from result set.
|
||||
* @param string value
|
||||
@@ -221,8 +203,6 @@ interface IDibiDriver
|
||||
*/
|
||||
function unescape($value, $type);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Injects LIMIT/OFFSET to the SQL query.
|
||||
* @param string &$sql The SQL query that will be modified.
|
||||
@@ -244,8 +224,6 @@ interface IDibiDriver
|
||||
*/
|
||||
function getRowCount();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Moves cursor position without fetching row.
|
||||
* @param int the 0-based cursor pos to seek to
|
||||
@@ -254,8 +232,6 @@ interface IDibiDriver
|
||||
*/
|
||||
function seek($row);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Fetches the row at current position and moves the internal cursor to the next position.
|
||||
* @param bool TRUE for associative array, FALSE for numeric
|
||||
@@ -264,8 +240,6 @@ interface IDibiDriver
|
||||
*/
|
||||
function fetch($type);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Frees the resources allocated for this result set.
|
||||
* @param resource result set resource
|
||||
@@ -273,8 +247,6 @@ interface IDibiDriver
|
||||
*/
|
||||
function free();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all columns in a result set.
|
||||
* @return array
|
||||
@@ -282,8 +254,6 @@ interface IDibiDriver
|
||||
*/
|
||||
function getColumnsMeta();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the result set resource.
|
||||
* @return mixed
|
||||
@@ -302,8 +272,6 @@ interface IDibiDriver
|
||||
*/
|
||||
function getTables();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all columns in a table.
|
||||
* @param string
|
||||
@@ -311,8 +279,6 @@ interface IDibiDriver
|
||||
*/
|
||||
function getColumns($table);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all indexes in a table.
|
||||
* @param string
|
||||
@@ -320,8 +286,6 @@ interface IDibiDriver
|
||||
*/
|
||||
function getIndexes($table);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns metadata for all foreign keys in a table.
|
||||
* @param string
|
||||
|
Reference in New Issue
Block a user