Skip to content

Commit

Permalink
Revert "[#14080] - Added escaping for tables with schemas"
Browse files Browse the repository at this point in the history
This reverts commit 9c0473b.
  • Loading branch information
niden committed Jul 6, 2019
1 parent 5fae345 commit 35163a4
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions phalcon/Mvc/Model.zep
Expand Up @@ -1112,7 +1112,6 @@ abstract class Model implements EntityInterface, ModelInterface, ResultInterface
} else {
let table = source;
}
let table = writeConnection->escapeIdentifier(table);

/**
* Join the conditions in the array using an AND operator
Expand Down Expand Up @@ -2169,8 +2168,7 @@ abstract class Model implements EntityInterface, ModelInterface, ResultInterface
let table = source;
}

let table = readConnection->escapeIdentifier(table),
uniqueKey = this->uniqueKey;
let uniqueKey = this->uniqueKey;

if !uniqueKey {
/**
Expand Down Expand Up @@ -2209,7 +2207,7 @@ abstract class Model implements EntityInterface, ModelInterface, ResultInterface
tables = dialect->select(
[
"columns": fields,
"tables": table,
"tables": readConnection->escapeIdentifier(table),
"where": uniqueKey
]
);
Expand Down Expand Up @@ -2309,8 +2307,7 @@ abstract class Model implements EntityInterface, ModelInterface, ResultInterface
/**
* Create/Get the current database connection
*/
let readConnection = this->getReadConnection(),
table = readConnection->escapeIdentifier(table);
let readConnection = this->getReadConnection();

/**
* We need to check if the record exists
Expand Down Expand Up @@ -4044,14 +4041,13 @@ abstract class Model implements EntityInterface, ModelInterface, ResultInterface
} else {
let table = source;
}
let table = connection->escapeIdentifier(table);

/**
* Here we use a single COUNT(*) without PHQL to make the execution
* faster
*/
let num = connection->fetchOne(
"SELECT COUNT(*) \"rowcount\" FROM " . table . " WHERE " . uniqueKey,
"SELECT COUNT(*) \"rowcount\" FROM " . connection->escapeIdentifier(table) . " WHERE " . uniqueKey,
null,
uniqueParams,
uniqueTypes
Expand Down

0 comments on commit 35163a4

Please sign in to comment.