本文整理汇总了PHP中odbc_autocommit函数的典型用法代码示例。如果您正苦于以下问题:PHP odbc_autocommit函数的具体用法?PHP odbc_autocommit怎么用?PHP odbc_autocommit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了odbc_autocommit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sql_db
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->dbname = $database;
$this->server = $sqlserver;
if ($this->persistency) {
$this->db_connect_id = odbc_pconnect($this->server, "", "");
} else {
$this->db_connect_id = odbc_connect($this->server, "", "");
}
if ($this->db_connect_id) {
@odbc_autocommit($this->db_connect_id, off);
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$this->sql_time += $endtime - $starttime;
return $this->db_connect_id;
} else {
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$this->sql_time += $endtime - $starttime;
return false;
}
}
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:33,代码来源:db2.php
示例2: sql_db
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->dbname = $database;
$this->server = $sqlserver;
if ($this->persistency) {
$this->db_connect_id = odbc_pconnect($this->server, "", "");
} else {
$this->db_connect_id = odbc_connect($this->server, "", "");
}
if ($this->db_connect_id) {
@odbc_autocommit($this->db_connect_id, off);
return $this->db_connect_id;
} else {
return false;
}
}
开发者ID:nmpetkov,项目名称:ZphpBB2,代码行数:19,代码来源:db2.php
示例3: __construct
/**
* Connection to the database
*
*/
public function __construct()
{
parent::__construct();
if ($this->table == '') {
$this->table = $this->table_prefix . str_replace('Model', '', get_class($this));
}
require FRAMEWORK . DS . 'conf' . DS . 'datastore.php';
$config = $datastore[$this->datastore];
if (!isset(self::$connection[$this->datastore])) {
self::$connection[$this->datastore] = odbc_connect('DRIVER={SQL Server};SERVER=' . $config['host'] . ';DATABASE=' . $config['db'] . '', $config['user'], $config['password']);
if (!self::$connection[$this->datastore]) {
throw new connectException('Could not connect to the datastore: ' . odbc_errormsg());
}
if (!odbc_autocommit(self::$connection[$this->datastore], false)) {
throw new connectException('unable to connect: ' . odbc_errormsg());
}
}
$this->con =& self::$connection[$this->datastore];
}
开发者ID:nephie,项目名称:AZL-website,代码行数:23,代码来源:mssqlmodel_.php
示例4: _sql_transaction
/**
* SQL Transaction
* @access: private
*/
function _sql_transaction($status = 'begin')
{
switch ($status) {
case 'begin':
return @odbc_autocommit($this->db_connect_id, false);
break;
case 'commit':
$result = @odbc_commit($this->db_connect_id);
@odbc_autocommit($this->db_connect_id, true);
return $result;
break;
case 'rollback':
$result = @odbc_rollback($this->db_connect_id);
@odbc_autocommit($this->db_connect_id, true);
return $result;
break;
}
return true;
}
开发者ID:yunsite,项目名称:gloryroad,代码行数:23,代码来源:mssql_odbc.php
示例5: _trans_rollback
/**
* Rollback Transaction.
*
* @return bool
*/
protected function _trans_rollback()
{
if (odbc_rollback($this->conn_id)) {
odbc_autocommit($this->conn_id, true);
return true;
}
return false;
}
开发者ID:recca0120,项目名称:laraigniter,代码行数:13,代码来源:odbc_driver.php
示例6: begin
/**
* Begin a transaction
*
* @param unknown_type $model
* @return boolean True on success, false on fail
* (i.e. if the database/model does not support transactions).
*/
function begin(&$model)
{
if (parent::begin($model)) {
if (odbc_autocommit($this->connection, false)) {
$this->_transactionStarted = true;
return true;
}
}
return false;
}
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:17,代码来源:dbo_odbc.php
示例7: trans_rollback
/**
* Rollback Transaction
*
* @return bool
*/
public function trans_rollback()
{
// When transactions are nested we only begin/commit/rollback the outermost ones
if (!$this->trans_enabled or $this->_trans_depth > 0) {
return TRUE;
}
$ret = odbc_rollback($this->conn_id);
odbc_autocommit($this->conn_id, TRUE);
return $ret;
}
开发者ID:NaszvadiG,项目名称:boilerplate,代码行数:15,代码来源:odbc_driver.php
示例8: RollbackTrans
function RollbackTrans()
{
if ($this->transOff) {
return true;
}
if ($this->transCnt) {
$this->transCnt -= 1;
}
$this->_autocommit = true;
$ret = odbc_rollback($this->_connectionID);
odbc_autocommit($this->_connectionID, true);
return $ret;
}
开发者ID:joeymetal,项目名称:v1,代码行数:13,代码来源:adodb-odbc.inc.php
示例9: _trans_rollback
/**
* Rollback Transaction
*
* @return bool
*/
protected function _trans_rollback()
{
if (odbc_rollback($this->conn_id)) {
odbc_autocommit($this->conn_id, TRUE);
return TRUE;
}
return FALSE;
}
开发者ID:borisper1,项目名称:vesi-cms-ng,代码行数:13,代码来源:odbc_driver.php
示例10: Simpson
# $Id$
# Sample PHP script accessing HyperSQL through the ODBC extension module.
# (Therefore, you need to have the PHP ODBC module installed).
# This test HyperSQL client uses the ODBC DSN "tstdsn" to connect up to a
# HyperSQL server. Just configure your own DSN to use the HyperSQL ODBC
# driver, specifying the HyperSQL server host name, database name, user,
# password, etc.
# Author: Blaine Simpson (blaine dot simpson at admc dot com)
# Empty strings for the username or password parameter here will defer
# to the ODBC manager for those values. I.e. the blanks here do not mean to
# send blanks to the database server.
$conn_id = odbc_connect('tstdsn', '', '');
if (!$conn_id) {
exit('Connection Failed: ' . $conn_id . "\n");
}
if (!odbc_autocommit($conn_id, FALSE)) {
exit("Failed to turn off AutoCommit mode\n");
}
if (!odbc_exec($conn_id, "DROP TABLE tsttbl IF EXISTS")) {
exit("DROP command failed\n");
}
if (!odbc_exec($conn_id, "CREATE TABLE tsttbl(\n id BIGINT generated BY DEFAULT AS IDENTITY,\n vc VARCHAR(20),\n entrytime TIMESTAMP DEFAULT current_timestamp NOT NULL\n)")) {
exit("CREATE TABLE command failed\n");
}
# First do a non-parameterized insert
if (!odbc_exec($conn_id, "INSERT INTO tsttbl(id, vc) VALUES(1, 'one')")) {
exit("Insertion of first row failed\n");
}
# Now parameterized inserts
$stmt = odbc_prepare($conn_id, "INSERT INTO tsttbl(id, vc) VALUES(?, ?)");
if (!$stmt) {
开发者ID:Necrontyr,项目名称:hsqldb,代码行数:31,代码来源:sample.php
示例11: is_resource
echo "resource? " . is_resource($r) . "\n";
if (!$r) {
echo odbc_errormsg();
exit(1);
}
$rh = odbc_exec($r, "CREATE TABLE IF NOT EXISTS innotable ( idx INT UNSIGNED NOT NULL ) TYPE=InnoDB");
if ($rh == NULL) {
echo odbc_errormsg($r);
exit(1);
}
$rh = odbc_exec($r, "INSERT INTO innotable SET idx=300");
if ($rh == NULL) {
echo odbc_errormsg($r);
exit(1);
}
odbc_autocommit($r, false);
$rh = odbc_exec($r, "INSERT INTO innotable SET idx=500");
if ($rh == NULL) {
echo odbc_errormsg($r);
exit(1);
}
odbc_rollback($r);
$rh = odbc_exec($r, "SELECT * FROM innotable");
if ($rh == NULL) {
echo odbc_errormsg($r);
exit(1);
}
// fetch
while ($rr = odbc_fetch_array($rh)) {
var_dump($rr);
}
开发者ID:jenalgit,项目名称:roadsend-php,代码行数:31,代码来源:commit-rollback.php
示例12: inTransaction
/**
* Is in transaction?
* @return bool
*/
public function inTransaction()
{
return !odbc_autocommit($this->connection);
}
开发者ID:floffel03,项目名称:pydio-core,代码行数:8,代码来源:DibiOdbcDriver.php
示例13: AutoCommitTransactions
function AutoCommitTransactions($auto_commit)
{
if (!$this->auto_commit == !$auto_commit) {
return 1;
}
if (!isset($this->supported["Transactions"])) {
return $this->SetError("Auto-commit transactions", "transactions are not supported");
}
if ($this->connection && !@odbc_autocommit($this->connection, $auto_commit)) {
return $this->SetODBCError("Auto-commit transactions", "Could not set transaction auto-commit mode to {$auto_commit}", $php_errormsg);
}
$this->auto_commit = $auto_commit;
return 1;
}
开发者ID:BackupTheBerlios,项目名称:zvs,代码行数:14,代码来源:metabase_odbc.php
示例14: commit
/**
* Commit transaction and re-enable autocommit mode
*
* @throws VerticaException
* @author Sergii Katrych <[email protected]>
*/
public function commit()
{
$result = odbc_commit($this->getConnection());
if (false === $result) {
throw new VerticaException("Failed to commit transaction due to " . odbc_errormsg($this->getConnection()), odbc_error($this->getConnection()));
}
$result = odbc_autocommit($this->getConnection(), true);
if (false === $result) {
throw new VerticaException("Failed to re-enable autocommit to get out of transactions mode. " . odbc_errormsg($this->getConnection()), odbc_error($this->getConnection()));
}
}
开发者ID:maschek,项目名称:vertica-php-adapter,代码行数:17,代码来源:VerticaOdbcAbstract.php
示例15: dirname
<?php
dirname(__FILE__);
odbc_autocommit($this->conn_id, FALSE);
session_set_save_handler($class, TRUE);
substr(__FILE__, 0, 5);
count($sql, true);
echo 0, 1.1, false, CONSTANTE, ns\Name;
print <<<HHH
HHH;
sprintf(<<<HHHH
HHHH
, $a);
//dirname(__FILE__) => __DIR__
开发者ID:exakat,项目名称:exakat,代码行数:14,代码来源:InternalParameterType.02.php
示例16: after_connect
public function after_connect()
{
odbc_autocommit($this->_con, false);
}
开发者ID:startsevsa,项目名称:cash,代码行数:4,代码来源:odbc.php
示例17: endTransaction
/**
* End a transaction by either committing changes made, or reverting them
*/
public function endTransaction($commit)
{
if ($commit) {
$result = $this->commit();
} else {
$result = $this->rollback();
}
switch ($this->mode) {
case "mysql":
if (!$this->server->autocommit(true)) {
$result = false;
}
break;
case "postgres":
$result = $this->query("SET AUTOCOMMIT = ON");
break;
case "redshift":
# Do nothing, and use the result from the commit/rollback
break;
case "odbc":
if (!odbc_autocommit($this->server, true)) {
$result = false;
}
break;
default:
throw new \Exception("endTransaction() not supported in this mode (" . $this->mode . ")");
}
if (!$result) {
$this->error();
}
$this->transaction = false;
return true;
}
开发者ID:duncan3dc,项目名称:sql-class,代码行数:36,代码来源:Sql.php
示例18: autocommit
public function autocommit($onOff)
{
odbc_autocommit($this->_lnk, $onOff);
}
开发者ID:schpill,项目名称:thin,代码行数:4,代码来源:Vertica.php
示例19: RollbackTrans
function RollbackTrans()
{
$ret = odbc_rollback($this->_connectionID);
odbc_autocommit($this->_connectionID, true);
return $ret;
}
开发者ID:qoire,项目名称:portal,代码行数:6,代码来源:adodb-odbc.inc.php
示例20: DibiDriverException
DibiDriverException(odbc_errormsg($this->connection).' '.odbc_error($this->connection));}odbc_autocommit($this->connection,TRUE);}function
inTransaction(){return!odbc_autocommit($this->connection);}function
开发者ID:nosko,项目名称:socialSearch,代码行数:2,代码来源:dibi.min.php
注:本文中的odbc_autocommit函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论