1: <?php
2: /**
3: * This code is licensed under AGPLv3 license or Afterlogic Software License
4: * if commercial version of the product was purchased.
5: * For full statements of the licenses see LICENSE-AFTERLOGIC and LICENSE-AGPL3 files.
6: */
7:
8: namespace Aurora\System\Db;
9:
10: /**
11: * @license https://www.gnu.org/licenses/agpl-3.0.html AGPL-3.0
12: * @license https://afterlogic.com/products/common-licensing Afterlogic Software License
13: * @copyright Copyright (c) 2019, Afterlogic Corp.
14: *
15: * @package Api
16: * @subpackage Db
17: */
18: class GeneralSql
19: {
20: /**
21: * @var int
22: */
23: protected $iExecuteCount;
24:
25: /**
26: * @var int
27: */
28: public $ErrorCode;
29:
30: /**
31: * @var string
32: */
33: public $ErrorDesc;
34:
35: /**
36: * @return bool
37: */
38: public function IsConnected()
39: {
40: return false;
41: }
42:
43: /**
44: * @param string $sLogDesc
45: * @param string $bIsSlaveExecute = false
46: * @return void
47: */
48: protected function log($sLogDesc, $bIsSlaveExecute = false)
49: {
50: if (\Aurora\System\Api::$bUseDbLog) {
51: if ($bIsSlaveExecute) {
52: \Aurora\System\Logger::LogSql('DB-Slave['.$this->iExecuteCount.'] > '.trim($sLogDesc));
53: } else {
54: \Aurora\System\Logger::LogSql('DB['.$this->iExecuteCount.'] > '.trim($sLogDesc));
55: }
56: }
57: }
58:
59: /**
60: * @param string $sErrorDesc
61: * @return void
62: */
63: protected function errorLog($sErrorDesc)
64: {
65: \Aurora\System\Logger::LogSql('DB ERROR < '.trim($sErrorDesc), \Aurora\System\Enums\LogLevel::Error);
66: }
67: }
68: