本文整理汇总了PHP中DBManager::executeQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP DBManager::executeQuery方法的具体用法?PHP DBManager::executeQuery怎么用?PHP DBManager::executeQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager
的用法示例。
在下文中一共展示了DBManager::executeQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProgramList
public function getProgramList($lang = false, $category = false, $offset = 0)
{
$programList = array();
$bindParams = array();
if (empty($lang) && empty($category)) {
IndexController::$isHomePage = true;
}
$pidCol = ProgramDetails_DBTable::PROGRAM_ID;
$langCol = ProgramDetails_DBTable::FK_LANGUAGE_ID;
$cateCol = ProgramDetails_DBTable::FK_CATEGORY_ID;
$limit = UserPreferencesController::get(PreferenceKeys::PAGINATOR_LIMIT);
$limit = empty($limit) ? Constants::PAGINATOR_LIMIT : $limit;
$totalRecordCount = (new ProgramDetailsController())->getAllRecordCount();
$this->processPaginator($offset, $limit, $totalRecordCount);
$query = 'SELECT ' . ProgramDetails_DBTable::DB_TABLE_NAME . '.*,' . Users_DBTable::DB_TABLE_NAME . '.' . Users_DBTable::USER_NAME . ' AS created_by,' . Category_DBTable::DB_TABLE_NAME . '.' . Category_DBTable::CATEGORY_NAME . ' AS category_name,' . Language_DBTable::DB_TABLE_NAME . '.' . Language_DBTable::LANGUAGE_NAME . ' AS language_name FROM ' . ProgramDetails_DBTable::DB_TABLE_NAME . ' INNER JOIN ' . Category_DBTable::DB_TABLE_NAME . ' ON ' . Category_DBTable::DB_TABLE_NAME . '.' . Category_DBTable::CATEGORY_ID . ' = ' . ProgramDetails_DBTable::DB_TABLE_NAME . '.' . ProgramDetails_DBTable::FK_CATEGORY_ID . ' INNER JOIN ' . Language_DBTable::DB_TABLE_NAME . ' ON ' . Language_DBTable::DB_TABLE_NAME . '.' . Language_DBTable::LANGUAGE_ID . ' = ' . ProgramDetails_DBTable::DB_TABLE_NAME . '.' . ProgramDetails_DBTable::FK_LANGUAGE_ID . ' INNER JOIN ' . Users_DBTable::DB_TABLE_NAME . ' ON ' . Users_DBTable::DB_TABLE_NAME . '.' . Users_DBTable::USER_ID . ' = ' . ProgramDetails_DBTable::FK_CREATED_BY . ' WHERE ';
if (!empty($lang)) {
$bindParams[] = $lang;
$query .= ProgramDetails_DBTable::DB_TABLE_NAME . '.' . ProgramDetails_DBTable::FK_LANGUAGE_ID . "=? AND ";
if (!empty($category)) {
$bindParams[] = $category;
$query .= ProgramDetails_DBTable::DB_TABLE_NAME . '.' . ProgramDetails_DBTable::FK_CATEGORY_ID . "=? AND ";
}
}
$query .= ProgramDetails_DBTable::DB_TABLE_NAME . '.' . ProgramDetails_DBTable::IS_DELETED . "= '0'";
if (!empty($offset) && is_numeric($offset)) {
$query .= ' LIMIT ' . $offset . ', ' . $limit;
} else {
$query .= ' LIMIT ' . $limit;
}
$resultSet = DBManager::executeQuery($query, $bindParams, true);
return $resultSet;
}
示例2: getSourceDetails
public function getSourceDetails($lang, $category, $pid)
{
$query = 'SELECT ' . ProgramDetails_DBTable::DB_TABLE_NAME . '.*,' . Category_DBTable::DB_TABLE_NAME . '.' . Category_DBTable::CATEGORY_NAME . ' AS category_name,' . Language_DBTable::DB_TABLE_NAME . '.' . Language_DBTable::LANGUAGE_NAME . ' AS language_name FROM ' . ProgramDetails_DBTable::DB_TABLE_NAME . ' INNER JOIN ' . Category_DBTable::DB_TABLE_NAME . ' ON ' . Category_DBTable::DB_TABLE_NAME . '.' . Category_DBTable::CATEGORY_ID . ' = ' . ProgramDetails_DBTable::DB_TABLE_NAME . '.' . ProgramDetails_DBTable::FK_CATEGORY_ID . ' INNER JOIN ' . Language_DBTable::DB_TABLE_NAME . ' ON ' . Language_DBTable::DB_TABLE_NAME . '.' . Language_DBTable::LANGUAGE_ID . ' = ' . ProgramDetails_DBTable::DB_TABLE_NAME . '.' . ProgramDetails_DBTable::FK_LANGUAGE_ID . ' WHERE ' . ProgramDetails_DBTable::DB_TABLE_NAME . '.' . ProgramDetails_DBTable::PROGRAM_ID . "=? AND " . ProgramDetails_DBTable::DB_TABLE_NAME . '.' . ProgramDetails_DBTable::FK_LANGUAGE_ID . "=? AND " . ProgramDetails_DBTable::DB_TABLE_NAME . '.' . ProgramDetails_DBTable::FK_CATEGORY_ID . "=? AND " . ProgramDetails_DBTable::DB_TABLE_NAME . '.' . ProgramDetails_DBTable::IS_DELETED . "= '0'";
$bindParams = array($pid, $lang, $category);
$resultSet = DBManager::executeQuery($query, $bindParams, true);
return current($resultSet);
}
示例3: getUserDetailsByName
public function getUserDetailsByName($username)
{
$query = "SELECT * FROM " . Users_DBTable::DB_TABLE_NAME . " WHERE ";
$query .= Users_DBTable::USER_NAME . " = ? AND " . Users_DBTable::IS_DELETED . " = 0";
$userData = DBManager::executeQuery($query, array($username), true);
return current($userData);
}
示例4: getFileInfoFromDB
public function getFileInfoFromDB($pid)
{
$fileInfo = array();
$query = "SELECT * FROM ";
$query .= ProgramDetails_DBTable::DB_TABLE_NAME . " WHERE ";
$query .= ProgramDetails_DBTable::PROGRAM_ID . "=? AND ";
$query .= ProgramDetails_DBTable::IS_DELETED . "='0'";
$resultSet = DBManager::executeQuery($query, array($pid), true);
if (!empty($resultSet)) {
$fileInfo = current($resultSet);
}
return $fileInfo;
}
示例5: getLanguageWiseMatchingDataset
public function getLanguageWiseMatchingDataset($searchString)
{
$keywords = explode(" ", $searchString);
$query = "SELECT program_details.*, category.name AS category_name, language.name AS language_name, users.user_name\n FROM program_details INNER JOIN category ON category.id = program_details.fk_category INNER JOIN\n language ON language.id = program_details.fk_language INNER JOIN users ON users.id=program_details.fk_created_by\n WHERE program_details.is_deleted = 0 AND (";
$whereClause = array();
$bindParam = array();
foreach ($keywords as $key => $keyword) {
$whereClause[] = " program_details.fk_language LIKE :searchQuery{$key} OR language.name LIKE :searchQuery{$key} ";
$bindParam['searchQuery' . $key] = '%' . trim($keyword) . '%';
}
$query .= implode(" OR ", $whereClause) . ');';
$resultSet = DBManager::executeQuery($query, $bindParam, true);
return $resultSet;
}
示例6: getLastInsertedRecord
public function getLastInsertedRecord($userId, $datetime, $filename)
{
$query = 'SELECT * FROM ' . ProgramDetails_DBTable::DB_TABLE_NAME . ' WHERE ';
$query .= ProgramDetails_DBTable::STORED_FILE_NAME . " = '" . $filename . "' AND ";
$query .= ProgramDetails_DBTable::CREATED_ON . " = '" . $datetime . "' AND ";
$query .= ProgramDetails_DBTable::FK_CREATED_BY . " = '" . $userId . "' AND ";
$query .= ProgramDetails_DBTable::IS_DELETED . " = 0 LIMIT 1";
$result = DBManager::executeQuery($query, array(), true);
if ($result) {
$row = current($result);
return $row[ProgramDetails_DBTable::PROGRAM_ID];
}
return false;
}
示例7: deleteProgram
/**
* Delete given program from system
*
* @param int $pid
* @return boolean
*/
public function deleteProgram($pid)
{
$programInfo = $this->getProgramListById($pid);
$query = "UPDATE " . ProgramDetails_DBTable::DB_TABLE_NAME . " SET ";
$query .= ProgramDetails_DBTable::IS_DELETED . "= '1' WHERE ";
$query .= ProgramDetails_DBTable::PROGRAM_ID . "='" . $pid . "' AND ";
$query .= ProgramDetails_DBTable::IS_DELETED . "= 0";
if (DBManager::executeQuery($query)) {
$fileToUnlink = Configuration::get(Configuration::CODE_BASE_DIR) . $programInfo[ProgramDetails_DBTable::FK_LANGUAGE_ID] . "/" . $programInfo[ProgramDetails_DBTable::FK_CATEGORY_ID] . "/" . $programInfo[ProgramDetails_DBTable::STORED_FILE_NAME];
unlink($fileToUnlink);
return true;
} else {
Logger::getLogger()->LogFatal("Unable to delete file => " . $fileToUnlink);
return false;
}
}
示例8: categoryExists
/**
* Checks in database if given category exists and is active?
*
* @param string $category
* @return boolean
*/
public function categoryExists($category)
{
$query = 'SELECT * FROM ' . Category_DBTable::DB_TABLE_NAME . ' WHERE ' . Category_DBTable::CATEGORY_ID . " = '" . $category . "' AND " . Category_DBTable::IS_DELETED . '=0';
$result = DBManager::executeQuery($query, array(), true);
return is_array($result) && count($result) > 0;
}
示例9: flushAll
/**
* Flush all user preference for given user Id
*
* @param int $userId
*/
private function flushAll($userId)
{
$query = 'DELETE FROM ' . UserPreferences_DBTable::DB_TABLE_NAME . ' WHERE ';
$query .= UserPreferences_DBTable::USER_ID . '=?';
if (DBManager::executeQuery($query, array($userId))) {
Session::remove(Session::SESS_USER_PREF_KEY);
}
}
示例10: languageExists
/**
* Checks in database if given language exists and is active?
*
* @param string $lang
* @return boolean
*/
public function languageExists($lang)
{
$query = 'SELECT * FROM ' . Language_DBTable::DB_TABLE_NAME . ' WHERE ' . Language_DBTable::LANGUAGE_ID . " = '" . $lang . "' AND " . Language_DBTable::IS_DELETED . '=0';
$result = DBManager::executeQuery($query, array(), true);
return is_array($result) && count($result) > 0;
}
示例11: insert
/**
* Wrapper method for DB insert operation
*
* @param string $table
* @param array $columns
* @param array $bind [Optional]
* @return boolean
*/
public static function insert($table, array $columns, array $bind = array())
{
$keyStr = implode(',', array_keys($columns));
$valStr = implode("','", $columns);
$query = "INSERT INTO `{$table}` ({$keyStr}) VALUE('{$valStr}');";
return DBManager::executeQuery($query, $bind);
}
示例12: array
function create_audit_table()
{
global $dictionary;
$table_name = $this->get_audit_table_name();
require 'metadata/audit_templateMetaData.php';
$fieldDefs = $dictionary['audit']['fields'];
$sql = $this->dbManager->helper->createTableSQLParams($table_name, $fieldDefs, array());
$msg = "Error creating table: " . $table_name . ":";
$this->dbManager->executeQuery($sql, $msg);
}
示例13: DBManager
<?php
session_start();
$_SESSION["varLanguage"] = 1;
// including the refernece of Database manaager
require_once $_SERVER['DOCUMENT_ROOT'] . "/Library/libDBManager/DBManager.php";
$db = new DBManager();
$result = $db->executeQuery("SELECT * FROM tblPinkArrow WHERE Page = 'TestPage'");
if ($result == -1) {
$db->executeQuery("INSERT INTO `tblPinkArrow` VALUES ('', 'TestPage','' )");
$a = mysql_insert_id();
$db->executeQuery("INSERT INTO `tblPinkArrow` VALUES ('', 'TestPage','')");
$b = mysql_insert_id();
$db->executeQuery("INSERT INTO `tblPinkArrowMessage` VALUES ('', {$a}, 'Session has been cancelled but no email contents found.','Test')");
$db->executeQuery("INSERT INTO `tblPinkArrowMessage` VALUES ('', {$b}, 'Session has been cancelled but no email contents found.Session has been cancelled but no email contents found.','Test')");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<script type="text/javascript" src="../libAjax/AjaxLib.js"></script>
<script type="text/javascript" src="libPinkArrow.js"></script>
<script language="javascript">
var pageName = 'TestPage';
pinkArrow.CancelEventBubbling('I,J,L,R,TR,TL,BL,BR');
</script>
<style>
input{
示例14: getCategoryPieStats
public function getCategoryPieStats()
{
$sql = "SELECT COUNT(*) as count, " . ProgramDetails_DBTable::FK_CATEGORY_ID . " AS category FROM " . ProgramDetails_DBTable::DB_TABLE_NAME . ' WHERE ' . ProgramDetails_DBTable::IS_DELETED . '=0 GROUP BY ' . ProgramDetails_DBTable::FK_CATEGORY_ID;
return DBManager::executeQuery($sql, array(), true);
}
示例15: insertProgramDescription
public function insertProgramDescription($params)
{
$query = "INSERT INTO " . ProgramDetails_DBTable::DB_TABLE_NAME . " VALUES('', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
$bindParams = array($params['program_title'], $params['language_id'], $params['category_id'], $params['actual_file_name'], $params['stored_file_name'], $params['level'], $params['program_description'], $params['is_verified'], Utils::getCurrentDatetime(), Utils::getCurrentDatetime(), $params['created_by'], 0);
return DBManager::executeQuery($query, $bindParams, false);
}