П О Р Т А Л                            
С Е Т Е В Ы Х                          
П Р О Е К Т О В                        
  
Поиск по сайту:
                                                 
Главная

О проекте

Web-мастеру
     HTML & JavaScript
     SSI
     Perl
     PHP
     XML & XSLT
     Unix Shell

MySQL

Безопасность

Хостинг

Другое








Самое читаемое:

Учебник PHP - "Для Чайника".
Просмотров 6106 раз(а).

Иллюстрированный самоучитель по созданию сайтов.
Просмотров 8254 раз(а).

Учебник HTML.
Просмотров 4881 раз(а).

Руководство по PHP5.
Просмотров 1968 раз(а).

Хостинг через призму DNS.
Просмотров 6975 раз(а).

Подборка текстов стандартных документов.
Просмотров 57525 раз(а).

Учебник PHP - Самоучитель
Просмотров 5172 раз(а).

Документация на MySQL (учебник & справочное руководство)
Просмотров 11299 раз(а).

Внешние атаки...
Просмотров 7253 раз(а).

Учебник PHP.
Просмотров 4261 раз(а).

SSI в примерах.
Просмотров 1203 раз(а).



 
 
| Добавить в избранное | Сделать стартовой | Помощь





Руководство по PHP
Пред. След.

PDO::beginTransaction

(no version information, might be only in CVS)

PDO::beginTransaction --  Initiates a transaction

Описание

bool PDO::beginTransaction ( void )

Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO object instance are not committed until you end the transaction by calling PDO::commit(). Calling PDO::rollback() will roll back all changes to the database and return the connection to autocommit mode.

Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit COMMIT will prevent you from rolling back any other changes within the transaction boundary.

Примеры

Пример 1. Roll back a transaction

The following example begins a transaction and issues two statements that modify the database before rolling back the changes. On MySQL, however, the DROP TABLE statement automatically commits the transaction so that none of the changes in the transaction are rolled back.

<?php
/* Begin a transaction, turning off autocommit */
$dbh->beginTransaction();

/* Change the database schema and data */
$sth = $dbh->exec("DROP TABLE fruit");
$sth = $dbh->exec("UPDATE dessert
    SET name = 'hamburger'"
);

/* Recognize mistake and roll back changes */
$dbh->rollBack();

/* Database connection is now back in autocommit mode */
?>

Смотрите также

PDO::commit()
PDO::rollBack()



Если Вы не нашли что искали, то рекомендую воспользоваться поиском по сайту:
 





Copyright © 2005-2016 Project.Net.Ru