当前位置: 首页>>代码示例>>PHP>>正文


PHP mysqli_autocommit函数代码示例

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


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


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