Commit 9b525f34 authored by zYne's avatar zYne

updated the DQL DELETE handling

parent a2016e2e
...@@ -529,8 +529,9 @@ final class Doctrine ...@@ -529,8 +529,9 @@ final class Doctrine
*/ */
public static function isValidClassname($classname) public static function isValidClassname($classname)
{ {
if (preg_match('~(^[a-z])|(_[a-z])|([\W])|(_{2})~', $classname)) if (preg_match('~(^[a-z])|(_[a-z])|([\W])|(_{2})~', $classname)) {
return false; return false;
}
return true; return true;
} }
......
...@@ -126,7 +126,7 @@ class Doctrine_Import_Oracle extends Doctrine_Import ...@@ -126,7 +126,7 @@ class Doctrine_Import_Oracle extends Doctrine_Import
$descr[$val['column_name']] = array( $descr[$val['column_name']] = array(
'name' => $val['column_name'], 'name' => $val['column_name'],
'notnull' => (bool) ($val['nullable'] === 'N'), // nullable is N when mandatory 'notnull' => (bool) ($val['nullable'] === 'N'),
'type' => $val['data_type'], 'type' => $val['data_type'],
'ptype' => $decl['type'], 'ptype' => $decl['type'],
'fixed' => $decl['fixed'], 'fixed' => $decl['fixed'],
......
...@@ -47,6 +47,14 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable { ...@@ -47,6 +47,14 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
* constant for UPDATE queries * constant for UPDATE queries
*/ */
const UPDATE = 2; const UPDATE = 2;
/**
* constant for INSERT queries
*/
const INSERT = 3;
/**
* constant for CREATE queries
*/
const CREATE = 4;
/** /**
* @param array $subqueryAliases the table aliases needed in some LIMIT subqueries * @param array $subqueryAliases the table aliases needed in some LIMIT subqueries
*/ */
...@@ -957,8 +965,14 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable { ...@@ -957,8 +965,14 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
$parts = $this->splitQuery($query); $parts = $this->splitQuery($query);
foreach($parts as $k => $part) { foreach($parts as $k => $part) {
$part = implode(" ",$part); $part = implode(' ', $part);
switch(strtoupper($k)) { switch(strtoupper($k)) {
case 'CREATE':
$this->type = self::CREATE;
break;
case 'INSERT':
$this->type = self::INSERT;
break;
case 'DELETE': case 'DELETE':
$this->type = self::DELETE; $this->type = self::DELETE;
break; break;
...@@ -1299,8 +1313,11 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable { ...@@ -1299,8 +1313,11 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
$this->tableIndexes[$tname] = 1; $this->tableIndexes[$tname] = 1;
} }
$this->parts['from'] = $this->conn->quoteIdentifier($table->getTableName());
$this->parts["from"] = $this->conn->quoteIdentifier($table->getTableName()) . ' ' . $tname; if ($this->type === self::SELECT) {
$this->parts['from'] .= ' ' . $tname;
}
$this->tableAliases[$currPath] = $tname; $this->tableAliases[$currPath] = $tname;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment