• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP mysqli_autocommit函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中mysqli_autocommit函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_autocommit函数的具体用法?PHP mysqli_autocommit怎么用?PHP mysqli_autocommit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了mysqli_autocommit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: salvarProduto

 public function salvarProduto($produto, $preco)
 {
     $codigo = $produto->getCodigo();
     $nome = $produto->getNome();
     $descricao = $produto->getDescricao();
     $imagem = $produto->getUrlImagem();
     $compra = $preco->getCompra();
     $venda = $preco->getVenda();
     $revenda = $preco->getReVenda();
     /*
      * conecta o banco de dados
      */
     $con = new JqsConnectionFactory();
     $link = $con->conectar();
     $query = "INSERT INTO tb_produtos (codigo_produto, nome_produto, descricao_produto, url_imagem) \n\t\tvalues('{$codigo}', '{$nome}', '{$descricao}', '{$imagem}')";
     $query2 = "INSERT INTO tb_precos (preco_compra, preco_venda, preco_revenda, id_produto_preco) \n\t\tvalues('{$compra}', '{$venda}', '{$revenda}', last_insert_id() )";
     try {
         mysqli_autocommit($link, FALSE);
         mysqli_query($link, $query) or die(mysqli_error($link) . "Produto");
         mysqli_query($link, $query2) or die(mysqli_error($link) . "Preço");
         mysqli_commit($link);
         mysqli_autocommit($link, TRUE);
     } catch (Exception $e) {
         mysqli_rollback($link);
         echo $e;
     }
 }
开发者ID:jaquesoliveira,项目名称:preciata-gh,代码行数:27,代码来源:ProdutoDao.php


示例2: sql_transaction

 function sql_transaction($status = 'begin')
 {
     switch ($status) {
         case 'begin':
             $result = @mysqli_autocommit($this->db_connect_id, false);
             $this->transaction = true;
             break;
         case 'commit':
             $result = @mysqli_commit($this->db_connect_id);
             @mysqli_autocommit($this->db_connect_id, true);
             $this->transaction = false;
             if (!$result) {
                 @mysqli_rollback($this->db_connect_id);
                 @mysqli_autocommit($this->db_connect_id, true);
             }
             break;
         case 'rollback':
             $result = @mysqli_rollback($this->db_connect_id);
             @mysqli_autocommit($this->db_connect_id, true);
             $this->transaction = false;
             break;
         default:
             $result = true;
     }
     return $result;
 }
开发者ID:kidwellj,项目名称:scuttle,代码行数:26,代码来源:mysqli.php


示例3: commit

 public function commit()
 {
     if (phpversion() < '5.5.0') {
         mysqli_autocommit($this->connection, TRUE);
     }
     // return mysqli_autocommit($this->connection, TRUE);
     mysqli_commit($this->connection);
 }
开发者ID:songfarm-david,项目名称:Songfarm,代码行数:8,代码来源:database.php


示例4: connect

 public function connect()
 {
     if ($this->link = mysqli_connect($this->host, $this->user, $this->pass)) {
         $this->exception("Could not connect to the database!");
     }
     mysqli_select_db($this->link, $this->name);
     mysqli_autocommit($this->link, false);
 }
开发者ID:brunitosessa,项目名称:armaelequipo,代码行数:8,代码来源:conexiones.php


示例5: commit

 public function commit()
 {
     if (mysqli_commit($this->conn)) {
         mysqli_autocommit($this->conn, true);
     } else {
         throw new server_except('cannot commit transaction');
     }
 }
开发者ID:xpd1437,项目名称:swap,代码行数:8,代码来源:mysql_rdb.php


示例6: rollback

 public function rollback()
 {
     if (mysqli_rollback($this->connection)) {
         mysqli_autocommit($this->connection, $this->autoCommit = true);
     } else {
         throw new Sabel_Db_Exception_Driver(mysql_error($this->connection));
     }
 }
开发者ID:reoring,项目名称:sabel,代码行数:8,代码来源:Driver.php


示例7: __construct

 function __construct($servername, $username, $password, $database)
 {
     $this->con = mysqli_connect($servername, $username, $password, $database);
     if (!$this->con) {
         $this->error = mysqli_connect_error();
         mysqli_autocommit($this->con, FALSE);
     }
     return $this->con;
 }
开发者ID:Eidolex,项目名称:Project,代码行数:9,代码来源:db.class.php


示例8: bind_twice

function bind_twice($link, $engine, $sql_type1, $sql_type2, $bind_type1, $bind_type2, $bind_value1, $bind_value2, $offset)
{
    if (!mysqli_query($link, "DROP TABLE IF EXISTS test_mysqli_stmt_bind_param_type_juggling_table_1")) {
        printf("[%03d + 1] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
        return false;
    }
    mysqli_autocommit($link, true);
    $sql = sprintf("CREATE TABLE test_mysqli_stmt_bind_param_type_juggling_table_1(col1 %s, col2 %s) ENGINE=%s", $sql_type1, $sql_type2, $engine);
    if (!mysqli_query($link, $sql)) {
        printf("[%03d + 2] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
        return false;
    }
    if (!($stmt = mysqli_stmt_init($link))) {
        printf("[%03d + 3] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
        return false;
    }
    if (!mysqli_stmt_prepare($stmt, "INSERT INTO test_mysqli_stmt_bind_param_type_juggling_table_1(col1, col2) VALUES (?, ?)")) {
        printf("[%03d + 4] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
        return false;
    }
    if (!mysqli_stmt_bind_param($stmt, $bind_type1 . $bind_type2, $bind_value1, $bind_value1)) {
        printf("[%03d + 5] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
        return false;
    }
    if (!mysqli_stmt_execute($stmt)) {
        printf("[%03d + 6] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
        return false;
    }
    if (!mysqli_stmt_bind_param($stmt, $bind_type1 . $bind_type2, $bind_value1, $bind_value2)) {
        printf("[%03d + 7] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
        return false;
    }
    if (!mysqli_stmt_execute($stmt)) {
        printf("[%03d + 8] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
        return false;
    }
    mysqli_stmt_close($stmt);
    if (!($res = mysqli_query($link, "SELECT col1, col2 FROM test_mysqli_stmt_bind_param_type_juggling_table_1"))) {
        printf("[%03d + 9] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
        return false;
    }
    if (2 !== ($tmp = mysqli_num_rows($res))) {
        printf("[%03d + 10] Expecting 2 rows, got %d rows [%d] %s\n", $offset, $tmp, mysqli_errno($link), mysqli_error($link));
    }
    $row = mysqli_fetch_assoc($res);
    if ($row['col1'] != $bind_value1 || $row['col2'] != $bind_value1) {
        printf("[%03d + 11] Expecting col1 = %s, col2 = %s got col1 = %s, col2 = %s - [%d] %s\n", $offset, $bind_value1, $bind_value1, $row['col1'], $row['col2'], mysqli_errno($link), mysqli_error($link));
        return false;
    }
    $row = mysqli_fetch_assoc($res);
    if ($row['col1'] != $bind_value1 || $row['col2'] != $bind_value2) {
        printf("[%03d + 12] Expecting col1 = %s, col2 = %s got col1 = %s, col2 = %s - [%d] %s\n", $offset, $bind_value1, $bind_value2, $row['col1'], $row['col2'], mysqli_errno($link), mysqli_error($link));
        return false;
    }
    mysqli_free_result($res);
    return true;
}
开发者ID:badlamer,项目名称:hhvm,代码行数:57,代码来源:mysqli_stmt_bind_param_type_juggling.php


示例9: dbConnect

 public function dbConnect()
 {
     $this->conn1 = @mysqli_connect($this->db_hostname, $this->db_username, $this->db_password, $this->db_name);
     if (!$this->conn1) {
         die(mysqli_connect_error());
     }
     $this->db1 = mysqli_select_db($this->conn1, $this->db_name) or die(mysqli_error($this->conn1));
     mysqli_autocommit($this->conn1, TRUE);
     return $this->conn1;
 }
开发者ID:asdhanapal,项目名称:dashboard_test_1,代码行数:10,代码来源:db.class.php


示例10: setAutoCommit

 static function setAutoCommit($con, $autoCommit)
 {
     try {
         $v = mysqli_autocommit($con, $autoCommit);
         if (!$v) {
             throw new Exception("Can not set commit automatically.");
         }
     } catch (Exception $e) {
         REDLog::writeErrLog($e->getMessage());
     }
 }
开发者ID:Taruca,项目名称:lib,代码行数:11,代码来源:DatabaseManager.php


示例11: __construct

 function __construct()
 {
     if (!$this->conectarSGBD()) {
         die("A conexão com o servidor não foi estabelecida!");
     }
     if (!$this->selecionarBanco()) {
         die("A conexão com o servidor não foi estabelecida!");
     }
     if (!mysqli_autocommit($this->conexao, false)) {
         die("Auto comite não ativado!");
     }
 }
开发者ID:GolfinhoPvP,项目名称:lokorez,代码行数:12,代码来源:ConectarMySQL.class.php


示例12: openConn

function openConn()
{
    // Create connection
    $conn = mysqli_connect();
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    mysqli_autocommit($conn, FALSE);
    // echo "Connected successfully <br>";
    $conn->select_db("dmhweborg");
    return $conn;
}
开发者ID:halversondm,项目名称:HalversonWeb,代码行数:13,代码来源:abc.php


示例13: createDbConnection

function createDbConnection($host, $username, $password, $dbname, $port = null)
{
    if (!$port) {
        $dbConnection = mysqli_connect($host, $username, $password, $dbname);
    } else {
        $dbConnection = mysqli_connect($host, $username, $password, $dbname, $port);
    }
    if (!$dbConnection) {
        die('Could not connect: ' . mysqli_connect_error());
    }
    $dbConnection->set_charset("utf8");
    mysqli_autocommit($dbConnection, FALSE);
    return $dbConnection;
}
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:14,代码来源:upgradeOS.php


示例14: dbNewMessage

 public function dbNewMessage($email, $name, $website, $message)
 {
     $email = mysqli_real_escape_string($this->link, $email);
     $name = mysqli_real_escape_string($this->link, $name);
     $website = mysqli_real_escape_string($this->link, $website);
     $message = mysqli_real_escape_string($this->link, $message);
     mysqli_autocommit($this->link, FALSE);
     $query = "INSERT INTO CONTACT(pk_contact,name,email,website,message) \n\t\t\t\t  VALUES('NULL','{$name}','{$email}','{$website}','{$message}')";
     mysqli_query($this->link, $query);
     if (mysqli_errno($this->link)) {
         return -1;
     } else {
         mysqli_commit($this->link);
         return 1;
     }
 }
开发者ID:a5216652166,项目名称:w2ssolutions,代码行数:16,代码来源:db.php


示例15: EndTransaction

 public function EndTransaction()
 {
     if (!$this->in_transazione) {
         return 0;
     }
     if ($this->Commit()) {
         mysqli_autocommit($this->conn, true);
         $this->in_transazione = false;
         return 1;
     } else {
         $this->Rollback();
         autocommit($this->conn, true);
         $this->in_transazione = false;
         return 0;
     }
 }
开发者ID:AlbertoArdu,项目名称:DistributedProgrammingExercises,代码行数:16,代码来源:ClassDB.php


示例16: commandDataBase

 function commandDataBase($sql)
 {
     $conn = new mysqli($this->servername, $this->username, $this->password, $this->dbname);
     if ($conn->connect_error) {
         die('Connection failed: ' . $conn->connect_error);
     }
     mysqli_autocommit($conn, FALSE);
     if ($conn->query($sql) === TRUE) {
         mysqli_commit($conn);
         return true;
     } else {
         mysqli_rollback($conn);
         return false;
     }
     $conn->close();
 }
开发者ID:schnurli13,项目名称:Storytelling,代码行数:16,代码来源:mysqlModule.php


示例17: getDbConnection

 public function getDbConnection($host, $username, $password, $dbname, $port)
 {
     if (!$this->dbConnection) {
         if (!$port) {
             $this->dbConnection = mysqli_connect($host, $username, $password, $dbname);
         } else {
             $this->dbConnection = mysqli_connect($host, $username, $password, $dbname, $port);
         }
     }
     if (!$this->dbConnection) {
         die('Could not connect: ' . mysqli_connect_error());
     }
     $this->dbConnection->set_charset("utf8");
     mysqli_autocommit($this->dbConnection, FALSE);
     return $this->dbConnection;
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:16,代码来源:UpgradeUtility.php


示例18: connect

 /**
  * Connect to database server
  *
  * @access	public
  * @return	boolean		Connection successful
  */
 public function connect()
 {
     //-----------------------------------------
     // Done SQL prefix yet?
     //-----------------------------------------
     $this->_setPrefix();
     //-----------------------------------------
     // Load query file
     //-----------------------------------------
     $this->_loadCacheFile();
     //-----------------------------------------
     // Connect
     //-----------------------------------------
     /* Did we add a port inline? */
     if (!$this->obj['sql_port'] and strstr($this->obj['sql_host'], ':')) {
         list($host, $port) = explode(':', $this->obj['sql_host']);
         $this->obj['sql_host'] = $host;
         $this->obj['sql_port'] = intval($port);
     }
     if ($this->obj['sql_port']) {
         $this->connection_id = @mysqli_connect($this->obj['sql_host'], $this->obj['sql_user'], $this->obj['sql_pass'], $this->obj['sql_database'], $this->obj['sql_port']);
     } else {
         $this->connection_id = @mysqli_connect($this->obj['sql_host'], $this->obj['sql_user'], $this->obj['sql_pass'], $this->obj['sql_database']);
     }
     if (!$this->connection_id) {
         $this->connect_failed = true;
         $this->throwFatalError();
         return FALSE;
     }
     mysqli_autocommit($this->connection_id, TRUE);
     //-----------------------------------------
     // Remove sensitive data
     //-----------------------------------------
     unset($this->obj['sql_host']);
     unset($this->obj['sql_user']);
     unset($this->obj['sql_pass']);
     //-----------------------------------------
     // If there's a charset set, run it
     //-----------------------------------------
     if ($this->obj['sql_charset']) {
         $this->query("SET NAMES '{$this->obj['sql_charset']}'");
     }
     parent::connect();
     return TRUE;
 }
开发者ID:dalandis,项目名称:Visualization-of-Cell-Phone-Locations,代码行数:51,代码来源:classDbMysqliClient.php


示例19: connect

 /**
  * (Lazy) connect.
  *
  * @throws Exception
  */
 private function connect()
 {
     // Was a custom port supplied with host?
     $port = null;
     if (strpos($this->host, ':') !== false) {
         list($this->host, $port) = explode(':', $this->host);
     }
     $this->link = mysqli_connect(($this->persistent ? 'p:' : '') . $this->host, $this->username, $this->password, $this->dbname, $port);
     if (!$this->link) {
         unset($this->link);
         throw new Exception('Unable to connect database');
     }
     mysqli_autocommit($this->link, false);
     // in general, we need one commit over page
     mysqli_set_charset($this->link, 'utf8');
     // must have to correct mysqli_real_escape_string!
     $this->beginTransaction();
 }
开发者ID:artoodetoo,项目名称:auth-sandbox,代码行数:23,代码来源:Mysqli.php


示例20: connect

 /**
  * 连接数据库
  * 
  * @return void 
  */
 public function connect()
 {
     if (!$this->_link) {
         $mysqli = mysqli_connect($this->_host, $this->_user, $this->_pass, '', $this->_port);
         if (!$mysqli) {
             die("{$this->_host}: 数据库服务器连接失败");
         }
         if ($mysqli->connect_error) {
             $this->_showError("{$this->_host}: 数据库服务器连接失败");
             exit;
         }
         $this->_link = $mysqli;
         mysqli_autocommit($this->_link, true);
         if ($this->_dbname) {
             $this->useDb($this->_dbname);
         }
     }
 }
开发者ID:elevenfox,项目名称:VTree,代码行数:23,代码来源:foxMysqli.class.php



注:本文中的mysqli_autocommit函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP mysqli_begin_transaction函数代码示例发布时间:2022-05-15
下一篇:
PHP mysqli_affected_rows函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap