private $modules = array('transaction' => false,
'expression' => false,
'export' => false,
- 'import' => false,
'unitOfWork' => false,
'formatter' => false,
);
return $this->formatter->quoteIdentifier($str, $checkOption);
}
- public function quoteMultipleIdentifier($arr, $checkOption = true)
- {
- foreach ($arr as $k => $v) {
- $arr[$k] = $this->quoteIdentifier($v, $checkOption);
- }
- return $arr;
- }
-
public function convertBooleans($item)
{
- return $this->formatter->convertBooleans($item);
+ if (is_array($item)) {
+ foreach ($item as $k => $value) {
+ if (is_bool($value)) {
+ $item[$k] = (int) $value;
+ }
+ }
+ } else {
+ if (is_bool($item)) {
+ $item = (int) $item;
+ }
+ }
+ return $item;
}
public function quote($input, $type = null)
}
}
- $query = 'CREATE TABLE ' . $this->conn->quoteIdentifier($name, true) . ' (' . $queryFields;
+ $query = 'CREATE TABLE ' . $this->conn->quoteIdentifier($name) . ' (' . $queryFields;
$check = $this->getCheckDeclaration($fields);
$fields = array();
foreach (array_keys($definition['fields']) as $field) {
- $fields[] = $this->conn->quoteIdentifier($field, true);
+ $fields[] = $this->conn->quoteIdentifier($field);
}
$query .= ' ('. implode(', ', $fields) . ')';
{
public function createDatabaseSql($name)
{
- return 'CREATE DATABASE ' . $this->conn->quoteIdentifier($name, true);
+ return 'CREATE DATABASE ' . $this->conn->quoteIdentifier($name);
}
public function dropDatabaseSql($name)
$queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')';
}
- $query = 'CREATE TABLE ' . $this->conn->quoteIdentifier($name, true) . ' (' . $queryFields . ')';
+ $query = 'CREATE TABLE ' . $this->conn->quoteIdentifier($name) . ' (' . $queryFields . ')';
$optionStrings = array();
public function getDeclaration($name, array $field)
{
- $declaration = $this->conn->quoteIdentifier($name, true) . ' ';
+ $declaration = $this->conn->quoteIdentifier($name) . ' ';
if (!isset($field['type']))
throw new IPF_ORM_Exception('Missing column type.');
} else {
$oldFieldName = $fieldName;
}
- $oldFieldName = $this->conn->quoteIdentifier($oldFieldName, true);
+ $oldFieldName = $this->conn->quoteIdentifier($oldFieldName);
$query .= 'CHANGE ' . $oldFieldName . ' '
. $this->getDeclaration($fieldName, $field['definition']);
}
$query.= ', ';
}
$field = $changes['rename'][$renamedField];
- $renamedField = $this->conn->quoteIdentifier($renamedField, true);
+ $renamedField = $this->conn->quoteIdentifier($renamedField);
$query .= 'CHANGE ' . $renamedField . ' '
. $this->getDeclaration($field['name'], $field['definition']);
}
return false;
}
- $name = $this->conn->quoteIdentifier($name, true);
+ $name = $this->conn->quoteIdentifier($name);
return 'ALTER TABLE ' . $name . ' ' . $query;
}
public function dropIndexSql($table, $name)
{
- $table = $this->conn->quoteIdentifier($table, true);
- $name = $this->conn->quoteIdentifier($this->conn->formatter->getIndexName($name), true);
+ $table = $this->conn->quoteIdentifier($table);
+ $name = $this->conn->quoteIdentifier($this->conn->formatter->getIndexName($name));
return 'DROP INDEX ' . $name . ' ON ' . $table;
}
public function dropTableSql($table)
{
- $table = $this->conn->quoteIdentifier($table, true);
+ $table = $this->conn->quoteIdentifier($table);
return 'DROP TABLE ' . $table;
}
return $text;
}
- public function convertBooleans($item)
- {
- if (is_array($item)) {
- foreach ($item as $k => $value) {
- if (is_bool($value)) {
- $item[$k] = (int) $value;
- }
- }
- } else {
- if (is_bool($item)) {
- $item = (int) $item;
- }
- }
- return $item;
- }
-
public function quoteIdentifier($str, $checkOption = true)
{
if ($checkOption && ! $this->conn->getAttribute(IPF_ORM::ATTR_QUOTE_IDENTIFIER)) {
return $tmp['start'] . $str . $tmp['end'];
}
- public function quoteMultipleIdentifier($arr, $checkOption = true)
- {
- foreach ($arr as $k => $v) {
- $arr[$k] = $this->quoteIdentifier($v, $checkOption);
- }
-
- return $arr;
- }
-
public function quote($input, $type = null)
{
if ($type == null) {
}
}
- public function fixIndexName($idx)
- {
- $indexPattern = '/^'.preg_replace('/%s/', '([a-z0-9_]+)', $this->conn->getAttribute(IPF_ORM::ATTR_IDXNAME_FORMAT)).'$/i';
- $indexName = preg_replace($indexPattern, '\\1', $idx);
- if ($indexName && ! strcasecmp($idx, $this->getIndexName($indexName))) {
- return $indexName;
- }
- return $idx;
- }
-
public function getIndexName($idx)
{
return sprintf($this->conn->getAttribute(IPF_ORM::ATTR_IDXNAME_FORMAT),