Exemplo n.º 1
0
 public function __get($strName)
 {
     switch ($strName) {
         case 'AffectedRows':
             return $this->objSqLite->changes();
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
Exemplo n.º 2
0
 public function __get($strName)
 {
     switch ($strName) {
         case 'AffectedRows':
             return $this->objMostRecentResult->rowCount();
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
Exemplo n.º 3
0
 public function __get($strName)
 {
     switch ($strName) {
         case 'AffectedRows':
             return mssql_affected_rows($this->objMsSql);
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
Exemplo n.º 4
0
 /**
  * This function displays helpful development info like queries sent to database and memory usage.
  * By default it shows only if database profiling is enabled in any configured database connections.
  * 
  * If forced to show when profiling is disabled you can monitor qcodo memory usage more accurately,
  * as collecting database profiling information tends to noticeable bigger memory consumption.
  * 
  * @param boolean $blnForceDisplay optional parameter, set true to always display info even if DB profiling is disabled
  * @return void
  */
 public static function DisplayProfilingInfo($blnForceDisplay = false)
 {
     if (QDatabaseBase::IsAnyDatabaseProfilingEnabled() || $blnForceDisplay) {
         print '<br clear="all"/><div style="padding: 5px; text-align: left; margin: 1em auto; border: 1px solid #888888; width: 800px;">';
         // Output DB Profiling Data
         foreach (QApplication::$Database as $objDb) {
             if ($objDb->EnableProfiling == true) {
                 $objDb->OutputProfiling();
             }
         }
         // Output runtime statistics
         if (function_exists('memory_get_peak_usage')) {
             print 'memory_get_peak_usage: ' . QString::GetByteSize(memory_get_peak_usage(true)) . ' / ' . ini_get('memory_limit') . '<br/>';
         }
         print 'max_execution_time: ' . ini_get('max_execution_time') . '&nbsp;s<br/>';
         print 'max_input_time: ' . ini_get('max_input_time') . '&nbsp;s<br/>';
         print 'upload_max_filesize: ' . ini_get('upload_max_filesize') . '<br/>';
         // Output any other PHPINI issues
         if (ini_get('safe_mode')) {
             print '<font color="red">safe_mode need to be disabled</font><br/>';
         }
         if (ini_get('magic_quotes_gpc')) {
             print '<font color="red">magic_quotes_gpc need to be disabled</font><br/>';
         }
         if (ini_get('magic_quotes_runtime')) {
             print '<font color="red">magic_quotes_runtime need to be disabled</font><br/>';
         }
         print '</div>';
     }
 }
Exemplo n.º 5
0
 /**
  * This function begins the database transaction.
  * @return void Nothing
  */
 public final function TransactionBegin()
 {
     if (0 == $this->intTransactionDepth) {
         $this->ExecuteTransactionBegin();
         $objCacheProvider = QApplication::$objCacheProvider;
         if ($objCacheProvider && $this->Caching && !$objCacheProvider instanceof QCacheProviderNoCache) {
             if (!self::$objCacheProviderStack) {
                 self::$objCacheProviderStack = new QStack();
             }
             self::$objCacheProviderStack->Push($objCacheProvider);
             QApplication::$objCacheProvider = new QCacheProviderProxy($objCacheProvider);
         }
     }
     $this->intTransactionDepth++;
 }
Exemplo n.º 6
0
 /**
  * This function displays helpful development info like queries sent to database and memory usage.
  * By default it shows only if database profiling is enabled in any configured database connections.
  * 
  * If forced to show when profiling is disabled you can monitor qcodo memory usage more accurately,
  * as collecting database profiling information tends to noticeable bigger memory consumption.
  * 
  * @param boolean $blnForceDisplay optional parameter, set true to always display info even if DB profiling is disabled
  * @return void
  */
 public static function DisplayProfilingInfo($blnForceDisplay = false)
 {
     if (QDatabaseBase::IsAnyDatabaseProfilingEnabled() || $blnForceDisplay) {
         print '<br style="clear: both; font-size: 0px"/>';
         print '<div style="padding: 1em; text-align: left; margin: 1em; border: 1px solid #888; color: #000; background-color: #FFF;">';
         // Output DB Profiling Data
         foreach (QApplication::$Database as $objDb) {
             if ($objDb->EnableProfiling == true) {
                 $objDb->OutputProfiling();
             }
         }
         // Output runtime statistics / settings
         print 'memory_get_peak_usage: ' . QString::GetByteSize(memory_get_peak_usage(true)) . ' / ' . ini_get('memory_limit') . '<br/>';
         print 'max_execution_time: ' . ini_get('max_execution_time') . '&nbsp;s<br/>';
         print 'max_input_time: ' . ini_get('max_input_time') . '&nbsp;s<br/>';
         print 'upload_max_filesize: ' . ini_get('upload_max_filesize') . '<br/>';
         // Output any other PHPINI issues
         if (ini_get('safe_mode')) {
             print '<span style="color: red;">safe_mode need to be disabled</span><br/>';
         }
         if (ini_get('magic_quotes_gpc')) {
             print '<span style="color: red;">magic_quotes_gpc need to be disabled</span><br/>';
         }
         if (ini_get('magic_quotes_runtime')) {
             print '<span style="color: red;">magic_quotes_runtime need to be disabled</span><br/>';
         }
         print '<a href="#" onClick="qcodo.loadFirebugLite(); return false;">load Firebug Lite</a><br/>';
         print '</div>';
     }
 }
 public function __get($strName)
 {
     switch ($strName) {
         case 'AffectedRows':
             return $this->objOracle->affected_rows;
         case 'EscapeIdentifierBegin':
             return $this->EscapeIdentifierBegin;
         case 'EscapeIdentifierEnd':
             return $this->EscapeIdentifierEnd;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
Exemplo n.º 8
0
 /**
  * @return string
  */
 public function GetStatement()
 {
     $this->ProcessClauses();
     // SELECT Clause
     if ($this->blnCountOnlyFlag) {
         if ($this->blnDistinctFlag) {
             $strSql = "SELECT\r\n    COUNT(*) AS q_row_count\r\n" . "FROM    (SELECT DISTINCT ";
             $strSql .= "    " . implode(",\r\n    ", $this->strSelectArray);
         } else {
             $strSql = "SELECT\r\n    COUNT(*) AS q_row_count\r\n";
         }
     } else {
         if ($this->blnDistinctFlag) {
             $strSql = "SELECT DISTINCT\r\n";
         } else {
             $strSql = "SELECT\r\n";
         }
         if ($this->strLimitInfo) {
             $strSql .= $this->objDatabase->SqlLimitVariablePrefix($this->strLimitInfo) . "\r\n";
         }
         $strSql .= "    " . implode(",\r\n    ", $this->strSelectArray);
     }
     // FROM and JOIN Clauses
     $strSql .= sprintf("\r\nFROM\r\n    %s\r\n    %s", implode(",\r\n    ", $this->strFromArray), implode("\r\n    ", $this->strJoinArray));
     // WHERE Clause
     if (count($this->strWhereArray)) {
         $strWhere = implode("\r\n    ", $this->strWhereArray);
         if (trim($strWhere) != '1=1') {
             $strSql .= "\r\nWHERE\r\n    " . $strWhere;
         }
     }
     // Additional Ordering/Grouping/Having clauses
     if (count($this->strGroupByArray)) {
         $strSql .= "\r\nGROUP BY\r\n    " . implode(",\r\n    ", $this->strGroupByArray);
     }
     if (count($this->strHavingArray)) {
         $strHaving = implode("\r\n    ", $this->strHavingArray);
         $strSql .= "\r\nHaving\r\n    " . $strHaving;
     }
     if (count($this->strOrderByArray)) {
         $strSql .= "\r\nORDER BY\r\n    " . implode(",\r\n    ", $this->strOrderByArray);
     }
     // Limit Suffix (if applicable)
     if ($this->strLimitInfo) {
         $strSql .= "\r\n" . $this->objDatabase->SqlLimitVariableSuffix($this->strLimitInfo);
     }
     // For Distinct Count Queries
     if ($this->blnCountOnlyFlag && $this->blnDistinctFlag) {
         $strSql .= "\r\n) as q_count_table";
     }
     return $strSql;
 }