本文整理汇总了PHP中oseDB::lock方法的典型用法代码示例。如果您正苦于以下问题:PHP oseDB::lock方法的具体用法?PHP oseDB::lock怎么用?PHP oseDB::lock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oseDB
的用法示例。
在下文中一共展示了oseDB::lock方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getloginRedirect
function getloginRedirect($msc_id)
{
$db = oseDB::instance();
oseDB::lock('#__menu');
$objs = array();
$where = array();
//$where = array_merge($where,oseJSON::generateQueryWhere());
// Added in V 4.4, menu access levels
//$where[] = 'm.menutype = '.$db->Quote($menutype);
$where[] = 'm.published != -2';
$where[] = 'm.client_id = 0';
$where = count($where) ? ' WHERE (' . implode(') AND (', $where) . ')' : '';
$query = 'SELECT m.*, com.name AS com_name' . ' FROM `#__menu` AS m' . ' LEFT JOIN `#__extensions` AS com ON com.extension_id = m.component_id' . $where . ' ORDER BY m.lft';
$db->setQuery($query);
//oseExit($db->getQuery());
$menus = $db->loadObjectList();
$i = 0;
if (!empty($menus)) {
foreach ($menus as $menu) {
$objs[$i]->menuid = $menu->id;
$objs[$i]->displayText = str_repeat('<span class="gtr">|—</span>', $menu->level) . '[ID-' . $menu->id . ']-' . $menu->title;
$i++;
}
}
oseDB::unlock();
return $objs;
}
示例2: insert
public static function insert($table, $insertValues)
{
$db = oseDB::instance();
oseDB::lock($table . ' WRITE');
$tables = self::getDBFields($table);
$temp = array();
if (!empty($tables)) {
foreach ($tables[$table] as $field => $info) {
if (isset($insertValues[$field])) {
$temp[$field] = $insertValues[$field];
}
}
$filterValues = array();
foreach ($temp as $key => $value) {
$filterValues[$key] = $db->Quote($value);
}
$sql = array();
$sql1 = '`' . implode('`,`', array_keys($filterValues)) . '`';
$sql2 = '' . implode(',', $filterValues) . '';
if (empty($filterValues)) {
oseDB::unlock();
return true;
}
$query = " INSERT INTO `{$table}` " . " ({$sql1}) " . " VALUES" . " ({$sql2})";
$db->setQuery($query);
$result = $db->query() ? $db->insertid() : false;
oseDB::unlock();
return $result;
} else {
oseDB::unlock();
return true;
}
}
示例3: getProperty
function getProperty($msc_id)
{
$db = oseDB::instance();
oseDB::lock('#__osemsc_acl READ');
$query = " SELECT * FROM `#__osemsc_acl`" . " WHERE id = {$msc_id}";
$db->setQuery($query);
$item = oseDB::loadItem();
oseDB::unlock();
return $item;
}
示例4: orderChange
public static function orderChange($node, $ordering)
{
$db = oseDB::instance();
$current = $node;
$type = $db->Quote($current->type);
oseDB::lock('#__osemsc_addon');
$query = " SELECT * FROM `#__osemsc_addon`" . " WHERE type={$type} AND ordering= {$ordering} ";
$db->setQuery($query);
// get the Current Msc paranet ID
$obj = $db->loadObject();
if ($current->ordering > $ordering) {
$query = " UPDATE `#__osemsc_addon` " . " SET ordering= ordering+1 " . " WHERE ordering >= {$ordering} AND ordering < {$current->ordering} " . " AND type={$type}";
$db->setQuery($query);
if (!oseDB::query()) {
oseDB::unlock();
return false;
}
$query = " UPDATE `#__osemsc_addon` " . " SET ordering= {$ordering} " . " WHERE id = {$current->id} ";
$db->setQuery($query);
if (!oseDB::query()) {
oseDB::unlock();
return false;
}
} else {
$query = " UPDATE `#__osemsc_addon` " . " SET ordering= ordering-1 " . " WHERE ordering <= {$ordering} AND ordering > {$current->ordering} " . " AND type={$type}";
$db->setQuery($query);
if (!oseDB::query()) {
oseDB::unlock();
return false;
}
$query = " UPDATE `#__osemsc_addon` " . " SET ordering= {$ordering} " . " WHERE id = {$current->id} ";
$db->setQuery($query);
if (!oseDB::query()) {
oseDB::unlock();
return false;
}
}
oseDB::unlock();
return true;
}
示例5: getNodeByOrder
public static function getNodeByOrder($parent_id, $ordering, $type = 'array')
{
$db = oseDB::instance();
oseDB::lock('#__osemsc_acl READ');
$query = " SELECT * FROM `#__osemsc_acl`" . " WHERE parent_id = {$parent_id} AND ordering = {$ordering} ";
$db->setQuery($query);
$obj = oseDB::loadItem($type);
oseDB::unlock();
return $obj;
}
示例6: getloginRedirect
function getloginRedirect($msc_id)
{
$db = oseDB::instance();
oseDB::lock('#__menu');
$objs = array();
$query = "SELECT * FROM `#__menu` WHERE `published` = 1 ORDER BY `menutype`, `ordering` ASC";
$db->setQuery($query);
$menus = $db->loadObjectList();
$i = 0;
if (!empty($menus)) {
foreach ($menus as $menu) {
$objs[$i]->menuid = $menu->id;
$objs[$i]->displayText = '[ID-' . $menu->id . ']-' . $menu->name;
$i++;
}
}
oseDB::unlock();
return $objs;
}