文字

maxdb_autocommit

maxdb::auto_commit

(PECL maxdb >= 1.0)

maxdb_autocommit -- maxdb::auto_commitTurns on or off auto-commiting database modifications

说明

过程化风格

bool maxdb_autocommit ( resource $link , bool $mode )

面向对象风格

bool maxdb::auto_commit ( bool $mode )

maxdb_autocommit() is used to turn on or off auto-commit mode on queries for the database connection represented by the link resource.

返回值

成功时返回 TRUE , 或者在失败时返回 FALSE

范例

Example #1 面向对象风格

<?php
$maxdb 
= new  maxdb ( "localhost" "MONA" "RED" "DEMODB" );

if (
maxdb_connect_errno ()) {
   
printf ( "Connect failed: %s\n" maxdb_connect_error ());
   exit();
}


$maxdb -> autocommit ( TRUE );


$maxdb -> close ();
?>

Example #2 过程化风格

<?php
$link 
maxdb_connect ( "localhost" "MONA" "RED" "DEMODB" );

if (!
$link ) {
   
printf ( "Can't connect to localhost. Error: %s\n" maxdb_connect_error ());
   exit();
}


maxdb_autocommit ( $link TRUE );


maxdb_close ( $link );
?>

以上例程的输出类似于:

参见

  • maxdb_commit() - Commits the current transaction
  • maxdb_rollback() - Rolls back current transaction
上一篇: 下一篇: