function DriverLinterExec($conn, $sql) { $result = @linter_exec_direct($conn, $sql); if ($result < 0 && stripos($sql, 'DROP') === false) { //ignoring drop errors _raiseError($result, $conn, array('sql' => $sql)); throw new lmbDbException('Linter execute error happened: ' . $sql . linter_last_error($conn)); } }
function execute($sql) { $result = null; $sql = $this->prepare_sql($sql); $result = $this->handle_cursor_pool(); $res = linter_exec_direct($this->useConnection ? $this->connectionId : $result, $sql); $this->log("Query direct executed: {$sql}, result:{$res}"); return $this->handle_call_result($res, $result, $sql); }
<?php set_include_path(dirname(__FILE__) . '/../../../../'); $mark = microtime(true); require_once 'limb/core/common.inc.php'; require_once 'limb/dbal/common.inc.php'; echo "dbal common includes: " . (microtime(true) - $mark) . "\n"; $linter_db = linter_open_connect('SYSTEM', 'MANAGER', 'Demo', TM_AUTOCOMMIT); $cur = linter_open_cursor($linter_db); linter_exec_direct($cur, 'CREATE OR REPLACE TABLE "foo" ("bar" varchar(10));'); linter_exec_direct($cur, 'INSERT INTO "foo" VALUES (\'some value\');'); $mark = microtime(true); for ($i = 0; $i < 1000; $i++) { linter_exec_direct($cur, 'SELECT "bar" FROM "foo";'); while (is_array($entry = linter_fetch_array($cur))) { $bar = $entry['bar']; } } echo "native linter fetching: " . (microtime(true) - $mark) . "\n"; $conn = lmbDBAL::newConnection('linter://*****:*****@localhost/Demo'); $mark = microtime(true); for ($i = 0; $i < 1000; $i++) { $rs = lmbDBAL::fetch('SELECT "bar" FROM "foo";', $conn); foreach ($rs as $record) { $bar = $record['bar']; } $rs->freeQuery(); } echo "lmbDBAL :: fetch(), array access: " . (microtime(true) - $mark) . "\n"; $mark = microtime(true); for ($i = 0; $i < 1000; $i++) {