本文整理汇总了PHP中MySQL::Result方法的典型用法代码示例。如果您正苦于以下问题:PHP MySQL::Result方法的具体用法?PHP MySQL::Result怎么用?PHP MySQL::Result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySQL
的用法示例。
在下文中一共展示了MySQL::Result方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Tree_Parents
function Tree_Parents($TableID, $RowID)
{
/****************************************************************************/
$__args_types = array('string', 'integer');
#-----------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/****************************************************************************/
$Regulars = Regulars();
#-----------------------------------------------------------------------------
if (!Preg_Match($Regulars['ID'], $TableID)) {
return new gException('WRONG_TABLE_ID', 'Неверный идентификатор таблицы');
}
#-----------------------------------------------------------------------------
$Row = DB_Select($TableID, '*', array('UNIQ', 'ID' => $RowID));
#---------------------------------------------------------------------------
switch (ValueOf($Row)) {
case 'error':
return ERROR | @Trigger_Error('[Tree_Parents]: не возможно найти запись');
case 'exception':
return new gException('ROW_NOT_FOUND', 'Запись не найдена');
case 'array':
#-------------------------------------------------------------------------
$Query = SPrintF('SELECT * FROM `%s` `TableA` WHERE `ParentID` = %u AND `ID` != `ParentID` AND EXISTS(SELECT * FROM `%s` `TableB` WHERE `TableB`.`ParentID` = `TableA`.`ID`)', $TableID, $Row['ID'], $TableID);
#-------------------------------------------------------------------------
$IsQuery = DB_Query($Query);
if (Is_Error($IsQuery)) {
return ERROR | @Trigger_Error('[Tree_Parents]: не возможно найти дочерние записи');
}
#-------------------------------------------------------------------------
$Childs = MySQL::Result($IsQuery);
#-------------------------------------------------------------------------
$Result = array($Row['ID']);
#-------------------------------------------------------------------------
foreach ($Childs as $Child) {
#-----------------------------------------------------------------------
$Parents = Tree_Parents($TableID, (int) $Child['ID']);
#-----------------------------------------------------------------------
switch (ValueOf($Parents)) {
case 'error':
return ERROR | @Trigger_Error('[Tree_Parents]: не возможно определить дочерние вхождения записей');
case 'exception':
return ERROR | @Trigger_Error('[Tree_Parents]: запись оказавшаяся дочерней не найдена');
case 'array':
$Result = Array_Merge($Result, $Parents);
break;
default:
return ERROR | @Trigger_Error(101);
}
}
#-------------------------------------------------------------------------
return $Result;
break;
default:
return ERROR | @Trigger_Error(101);
}
}
示例2: array
$DOM->AddAttribs('Body', array('onload' => "ShowWindow('/ProfileEdit',{TemplatesIDs:'Juridical,Individual'});"));
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!CacheManager::isEnabled()) {
$__MESSAGES[] = 'Система кеширования недоступна. Биллинг может работать быстрее используя ресурсы оперативной памяти. Убедитесь что memcached запущен и модуль для PHP установлен.';
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Result = DB_Query('SHOW ENGINES');
if (Is_Error($Result)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Engines = MySQL::Result($Result);
if (Is_Error($Engines)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
foreach ($Engines as $Engine) {
#-------------------------------------------------------------------------------
if ($Engine['Engine'] == 'InnoDB') {
#-------------------------------------------------------------------------------
if ($Engine['Support'] != 'YES' && $Engine['Support'] != 'DEFAULT') {
#-------------------------------------------------------------------------------
$__MESSAGES[] = 'MySQL собран без поддержки InnoDB, или возможность использования InnoDB в MySQL отключена. Пожалуйста, исправьте возникшую проблему, т.к. биллинговая система не может использовать транзации и поддержку ссылочной целостности, что может привести к потерям данных.';
#-------------------------------------------------------------------------------
break;
#-------------------------------------------------------------------------------
}
示例3: Current
if (Count($Rows) < 1) {
return ERROR | @Trigger_Error('[Demon]: неверный результат запроса');
}
#-------------------------------------------------------------------------------
$Row = Current($Rows);
#-------------------------------------------------------------------------------
if (!$Row['IsFree']) {
return 'Cron already executing (lock is not free)...';
}
#-------------------------------------------------------------------------------
$Lock = DB_Query(SPrintF("SELECT GET_LOCK('%s',10) as `IsLocked`", $LockID));
if (Is_Error($Lock)) {
return ERROR | @Trigger_Error('[Demon]: не удалось установить блокировку');
}
#-------------------------------------------------------------------------------
$Rows = MySQL::Result($Lock);
if (Is_Error($Rows)) {
return ERROR | @Trigger_Error('[Demon]: не удалось получить данные из запроса');
}
#-------------------------------------------------------------------------------
if (Count($Rows) < 1) {
return ERROR | @Trigger_Error('[Demon]: неверный результат запроса');
}
#-------------------------------------------------------------------------------
$Row = Current($Rows);
#-------------------------------------------------------------------------------
if (!$Row['IsLocked']) {
return 'Cron already executing (can not set lock)...';
}
#-------------------------------------------------------------------------------
$Comp = Comp_Load('Users/Init', 100);
示例4: Regulars
$Regulars = Regulars();
#-------------------------------------------------------------------------------
if (!Preg_Match($Regulars['ID'], $TableID)) {
return ERROR | @Trigger_Error(201);
}
#-------------------------------------------------------------------------------
if (Is_Error(System_Load('modules/Authorisation.mod', 'libs/Upload.php'))) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Result = DB_Query(SPrintF('SHOW COLUMNS FROM `%s`', $TableID));
if (Is_Error($Result)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Rows = MySQL::Result($Result);
if (Is_Error($Rows)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$ColumnsTypes = array();
#------------------------------------------------------------------------------
foreach ($Rows as $Row) {
$ColumnsTypes[$Row['Field']] = $Row;
}
#-------------------------------------------------------------------------------
$NoTypesDB =& Link_Get('NoTypesDB', 'boolean');
#-------------------------------------------------------------------------------
$NoTypesDB = TRUE;
#-------------------------------------------------------------------------------
$Row = DB_Select($TableID, '*', array('UNIQ', 'ID' => $RowID));
示例5: Tag
$Node1 = new Tag('node', array('TEXT' => 'Таблицы'));
#-------------------------------------------------------------------------------
$Node2 = new Tag('node', array('TEXT' => 'Представления'));
#-------------------------------------------------------------------------------
foreach ($Tables as $Table) {
#-----------------------------------------------------------------------------
$TableID = $Table['Name'];
#-----------------------------------------------------------------------------
$TableNode = new Tag('node', array('TEXT' => $TableID, 'FOLDED' => 'true'));
#-----------------------------------------------------------------------------
$Result = DB_Query(SPrintF('SHOW COLUMNS FROM `%s`', $TableID));
if (Is_Error($Result)) {
return ERROR | @Trigger_Error(500);
}
#-----------------------------------------------------------------------------
$Colomns = MySQL::Result($Result);
if (Is_Error($Colomns)) {
return ERROR | @Trigger_Error(500);
}
#-----------------------------------------------------------------------------
$Array = array();
#-----------------------------------------------------------------------------
foreach ($Colomns as $Colomn) {
#---------------------------------------------------------------------------
$ColumnNode = new Tag('node', array('TEXT' => $Colomn['Field']));
#---------------------------------------------------------------------------
$ColumnNode->AddChild(new Tag('hook', array('NAME' => 'accessories/plugins/NodeNote.properties'), new Tag('text', $Colomn['Type'])));
#---------------------------------------------------------------------------
$TableNode->AddChild($ColumnNode);
}
#-----------------------------------------------------------------------------
示例6: SUM
#---------------------------------------------------------------------------
$DomainScheme->AddChild($Registrator);
#---------------------------------------------------------------------------
$DomainOrder->AddChild($DomainScheme);
#---------------------------------------------------------------------------
$DomainsOrders->AddChild($DomainOrder);
}
#-----------------------------------------------------------------------------
$Contract->AddChild($DomainsOrders);
#-----------------------------------------------------------------------------
$Result = $Link->Query(SPrintF("SELECT SUM(`bonus`) as `Balance` FROM `partner` WHERE `userid` = %u", $dUser['ID']));
if (Is_Error($Result)) {
return $Link->GetError();
}
#-----------------------------------------------------------------------------
$dBonuses = MySQL::Result($Result);
if (Is_Error($dBonuses)) {
return ERROR | @Trigger_Error(500);
}
#-----------------------------------------------------------------------------
$dBonuse = Current($dBonuses);
#-----------------------------------------------------------------------------
$Contract->AddChild(new Tag('Balance', Round($Result['Balance'] * $Course)));
#-----------------------------------------------------------------------------
$Contracts->AddChild($Contract);
#-----------------------------------------------------------------------------
$User->AddChild($Contracts);
#-----------------------------------------------------------------------------
$Users->AddChild($User);
}
#-------------------------------------------------------------------------------
示例7: DB_Select
//.........这里部分代码省略.........
if ($GroupBy) {
#---------------------------------------------------------------------------
if (!Is_Array($GroupBy)) {
$GroupBy = array($GroupBy);
}
#---------------------------------------------------------------------------
$Array = array();
#---------------------------------------------------------------------------
foreach ($GroupBy as $ColumnID) {
$Array[] = SPrintF('`%s`', $ColumnID);
}
#---------------------------------------------------------------------------
$GroupBy = $Array;
#---------------------------------------------------------------------------
$Sql = SPrintF('%s GROUP BY %s', $Sql, Implode(',', $GroupBy));
}
#-----------------------------------------------------------------------------
$SortOn = $Query['SortOn'];
#-----------------------------------------------------------------------------
if ($SortOn) {
#---------------------------------------------------------------------------
if (!Is_Array($SortOn)) {
$SortOn = array($SortOn);
}
#---------------------------------------------------------------------------
$Array = array();
#---------------------------------------------------------------------------
foreach ($SortOn as $ColumnID) {
#-------------------------------------------------------------------------
$ColumnID = DB_Escape($ColumnID);
#-------------------------------------------------------------------------
#$Array[] = StrPos($ColumnID,'.')?$ColumnID:SPrintF('`%s`',$ColumnID);
# если в названии встречается точка или запятая - не ставим кавычки...
$Array[] = StrpBrk($ColumnID, '.,') ? $ColumnID : SPrintF('`%s`', $ColumnID);
#Debug(SPrintF('[system/libs/auto/DB]: SortOn = %s',$ColumnID));
#$Array[] = $ColumnID;
}
#---------------------------------------------------------------------------
$Sql = SPrintF('%s ORDER BY %s', $Sql, Implode(',', $Array));
}
#-----------------------------------------------------------------------------
if ($Query['IsDesc']) {
$Sql = SPrintF('%s DESC', $Sql);
}
#-----------------------------------------------------------------------------
$Limits = $Query['Limits'];
if (Count($Limits) > 1) {
$Sql = SPrintF('%s LIMIT %s, %s', $Sql, Current($Limits), Next($Limits));
}
#-----------------------------------------------------------------------------
$CacheID = SPrintF('[DB_Select]:%s', Md5($Sql));
#-----------------------------------------------------------------------------
if (!($Rows = Cache_Get($CacheID))) {
#---------------------------------------------------------------------------
$Result = DB_Query($Sql);
#---------------------------------------------------------------------------
switch (ValueOf($Result)) {
case 'error':
return ERROR | @Trigger_Error('[DB_Select]: невозможно осуществить запрос');
case 'resource':
#-----------------------------------------------------------------------
$Rows = MySQL::Result($Result);
#-----------------------------------------------------------------------
if (Count($Rows) < 1) {
return new gException('ROWS_NOT_FOUND', 'Записи не найдены');
}
#-----------------------------------------------------------------------
$NoTypesDB = Link_Get('NoTypesDB', 'boolean');
#-----------------------------------------------------------------------
if (!$NoTypesDB) {
#---------------------------------------------------------------------
for ($i = 0; $i < Count($Rows); $i++) {
#-------------------------------------------------------------------
$Row =& $Rows[$i];
#-------------------------------------------------------------------
$Row = DB_Types($Row, 'Explode');
if (Is_Error($Row)) {
return ERROR | @Trigger_Error('[DB_Select]: не удалось произвести преобразование типов');
}
}
}
#-----------------------------------------------------------------------
Cache_Add($CacheID, $Rows);
break;
default:
return ERROR | @Trigger_Error(101);
}
}
#-----------------------------------------------------------------------------
if (In_Array('UNIQ', $Query, TRUE)) {
#---------------------------------------------------------------------------
if (Count($Rows) > 1) {
return ERROR | @Trigger_Error('[DB_Select]: запись не является уникальной');
}
#---------------------------------------------------------------------------
$Rows = Current($Rows);
}
#-----------------------------------------------------------------------------
return $Rows;
}
示例8: DB_Query
#-------------------------------------------------------------------------------
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!Is_Null($UniqID)) {
#-------------------------------------------------------------------------------
$IsQuery = DB_Query(SPrintF('SHOW COLUMNS FROM `%s`', $TableID));
if (Is_Error($IsQuery)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Rows = MySQL::Result($IsQuery);
if (Is_Error($Rows)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
if (Count($Rows) < 1) {
return ERROR | @Trigger_Error(400);
}
#-------------------------------------------------------------------------------
$Columns = array();
#-------------------------------------------------------------------------------
foreach ($Rows as $Row) {
$Columns[] = SPrintF('%s %s', $Row['Field'], $Row['Type']);
}
#-------------------------------------------------------------------------------
$Create = SPrintF('CREATE TEMPORARY TABLE `%s` (%s) ENGINE=MEMORY DEFAULT CHARSET=utf8', $UniqID, Implode(',', $Columns));
示例9: DB_Select
if (!$Services || !Is_Array($Services)) {
$Services = DB_Select('Services', array('ID', 'Name', 'Code'), array('Where' => "`IsActive` = 'yes' AND `Code` NOT IN ('Default')"));
switch (ValueOf($Services)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return TRUE;
case 'array':
break;
default:
return ERROR | @Trigger_Error(101);
}
#-----------------------------------------------------------------------------
for ($i = 0; $i < Count($Services); $i++) {
$Query = DB_Query(SPrintF("SHOW TABLES LIKE '%s%%OrdersOwners'", $Services[$i]['Code']));
$Row = MySQL::Result($Query);
foreach (Array_Keys($Row[0]) as $Key) {
$Services[$i]['View'] = $Row[0][$Key];
}
$View = Preg_Split('/Owner/', $Services[$i]['View']);
$Services[$i]['Table'] = Current($View);
}
#-----------------------------------------------------------------------------
CacheManager::add($CacheID, $Services, 600);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#Debug("[Tasks/GC/EraseDeletedOrders]: " . print_r($Services,true));
#-------------------------------------------------------------------------------
for ($i = 0; $i < Count($Services); $i++) {
Debug(SPrintF("[Tasks/GC/EraseDeletedOrders]: Код текущей услуги - %s", $Services[$i]['Code']));
示例10: Tag
#---------------------------------------------------------------------------
$Dept = (int) $dTicket['dept'];
#---------------------------------------------------------------------------
$Ticket = new Tag('Ticket');
#---------------------------------------------------------------------------
$Ticket->AddChild(new Tag('CreateDate', $dTicket['thedate']));
$Ticket->AddChild(new Tag('PriorityID', $Dept > 1 ? $Dept > 2 ? 'Hight' : 'Middle' : 'Low'));
$Ticket->AddChild(new Tag('Theme', $dTicket['subj']));
$Ticket->AddChild(new Tag('StatusID', $dTicket['thestatus'] != 'OPENED' ? 'Closed' : 'Opened'));
#---------------------------------------------------------------------------
$Result = $Link->Query(SPrintF('SELECT * FROM `h_answers` WHERE `ticket` = %u', $dTicket['ID']));
if (Is_Error($Result)) {
return $Link->GetError();
}
#---------------------------------------------------------------------------
$dMessages = MySQL::Result($Result);
if (Is_Error($dMessages)) {
return ERROR | @Trigger_Error(500);
}
#---------------------------------------------------------------------------
if (!Count($dMessages)) {
continue;
}
#---------------------------------------------------------------------------
$Messages = new Tag('Messages');
#---------------------------------------------------------------------------
foreach ($dMessages as $dMessage) {
#-------------------------------------------------------------------------
foreach (Array_Keys($dMessage) as $ColumnID) {
#-----------------------------------------------------------------------
$Column =& $dMessage[$ColumnID];