本文整理汇总了PHP中Tbl::getPluginSQLFilePathsByTableName方法的典型用法代码示例。如果您正苦于以下问题:PHP Tbl::getPluginSQLFilePathsByTableName方法的具体用法?PHP Tbl::getPluginSQLFilePathsByTableName怎么用?PHP Tbl::getPluginSQLFilePathsByTableName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tbl
的用法示例。
在下文中一共展示了Tbl::getPluginSQLFilePathsByTableName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exec
/**
* Execute SQL query
*
* @param string $sql_statement
* @return MysqlQuery
*/
public function exec($sql_statement)
{
$query_str = '';
if (empty($sql_statement)) {
if (!empty($this->sql_statement)) {
$query_str = $this->sql_statement;
} else {
throw new EmptyArgumentException();
}
} else {
$query_str = $sql_statement;
}
if ($this->log) {
$this->logger->log(static::LOGGER_NAME, $sql_statement);
}
if (($this->result = mysql_query($query_str, $this->db_link)) != false) {
$this->last_fetch_type = '';
$this->last_field_position = 0;
$this->last_record_position = 0;
return $this;
} else {
$errorCode = $this->errorCode();
$errorMessage = $this->errorMessage();
if ($errorCode == 1146) {
preg_match("/Table \\'.*?\\.(.+?)\\' doesn\\'t exist/", $errorMessage, $matches);
if (isset($matches[1])) {
$nonExistantTableName = $matches[1];
if (!in_array($nonExistantTableName, $this->nonExitentTables)) {
$sqlFiles = Tbl::getPluginSQLFilePathsByTableName($nonExistantTableName);
if ($sqlFiles !== false) {
$db = Reg::get(ConfigManager::getConfig("Db", "Db")->Objects->Db);
$db->startTransaction();
foreach ($sqlFiles as $sqlFilePath) {
self::executeSQLFile($sqlFilePath);
}
if ($db->commit()) {
array_push($this->nonExitentTables, $nonExistantTableName);
return $this->exec($sql_statement);
} else {
$db->rollBack();
}
}
}
}
}
throw new MySqlException("MySQL Error: {$errorCode}: {$errorMessage} in query `{$sql_statement}`", $errorCode);
}
}