本文整理汇总了PHP中MySQLDatabase::Quote方法的典型用法代码示例。如果您正苦于以下问题:PHP MySQLDatabase::Quote方法的具体用法?PHP MySQLDatabase::Quote怎么用?PHP MySQLDatabase::Quote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySQLDatabase
的用法示例。
在下文中一共展示了MySQLDatabase::Quote方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GET_Ingredients
private function GET_Ingredients($params = array())
{
$search = getParam('search');
//TODO: Search ingredient titles, both private and public
//Crappy Query For Testing
$searchString = $search ? "AND title LIKE " . $this->DB->Quote("%{$search}%") : false;
$queryString = "SELECT * FROM tblIngredients WHERE userID = {$this->ID} {$searchString} LIMIT 10";
$query = $this->DB->Query($queryString);
$result = array();
if ($query) {
while ($row = $query->Fetch()) {
$ingredient = array_key_exists($row['id'], $this->Ingredients) ? $this->Ingredients[$row['id']] : new Ingredient($this, $row);
$result[$ingredient->ID] = $ingredient->ToArray();
}
}
APIResponse(RESPONSE_200, $result);
}
示例2: UpdateDatabase
/** @return bool */
public function UpdateDatabase()
{
$queryString = "\n UPDATE tblBars\n SET\n `type` = " . $this->DB->Quote($this->Type) . "\n , `title` = " . $this->DB->Quote($this->Title) . "\n , `description` = " . $this->DB->Quote($this->Description) . "\n , `modifyStamp` = " . microtime(true) . "\n WHERE id = " . (int) $this->ID . " AND userID = " . (int) $this->Session->ID . "\n ";
return (bool) $this->DB->Query($queryString);
}
示例3: mkdir
/*
* All this crap switches the environment to run from the testing database and session pool.
* Pass in /reset, and the database and sessions will be cleared, and a default user will be created.
*
* Magic!
*/
$dbCredentials = 'UnitTestDBCredentials';
if (!file_exists(UNITTESTSESSIONPATH)) {
mkdir(UNITTESTSESSIONPATH);
}
session_save_path(UNITTESTSESSIONPATH);
if (isset($Path[0]) && $Path[0] == 'reset') {
$rm = "rm " . UNITTESTSESSIONPATH . "*";
$rm = `{$rm}`;
$db = new MySQLDatabase('UnitTestDBCredentials');
$tables = $db->Query("\n\t\tSELECT table_name AS `table`\n\t\tFROM information_schema.tables\n\t\tWHERE table_schema = " . $db->Quote($UnitTestDBCredentials['name']) . ";\n\t");
singleLog($tables);
if ($tables) {
$db->Query("SET FOREIGN_KEY_CHECKS = 0;");
while ($table = $tables->Fetch()) {
singleLog($db->Query("DROP TABLE IF EXISTS " . $table['table'] . ";"));
}
$db->Query("SET FOREIGN_KEY_CHECKS = 1;");
}
$dump = "mysqldump -u " . $DevDBCredentials['user'] . " -p" . $DevDBCredentials['pass'] . " -d " . $DevDBCredentials['name'] . " | mysql -u " . $UnitTestDBCredentials['user'] . " -p" . $UnitTestDBCredentials['pass'] . " -D" . $UnitTestDBCredentials['name'] . "";
$dump = `{$dump}`;
$makeUser = $db->Query("INSERT INTO tblUsers (username, password, accountType, displayName, email) VALUES ('joe', 'nohomohug', 'Standard', 'Joe Testmoore', 'joe@testmoore.com');");
APIResponse(RESPONSE_200, "Cleared the database and sessions.");
exit;
}