db2_autocommit

(PECL ibm_db2 >= 1.0.0)

db2_autocommit Returns or sets the AUTOCOMMIT state for a database connection

Beschreibung

db2_autocommit(resource $connection, bool $value = ?): mixed

Sets or gets the AUTOCOMMIT behavior of the specified connection resource.

Parameter-Liste

connection

A valid database connection resource variable as returned from db2_connect() or db2_pconnect().

value

One of the following constants:

DB2_AUTOCOMMIT_OFF

Turns AUTOCOMMIT off.

DB2_AUTOCOMMIT_ON

Turns AUTOCOMMIT on.

Rückgabewerte

When db2_autocommit() receives only the connection parameter, it returns the current state of AUTOCOMMIT for the requested connection as an integer value. A value of DB2_AUTOCOMMIT_OFF indicates that AUTOCOMMIT is off, while a value of DB2_AUTOCOMMIT_ON indicates that AUTOCOMMIT is on.

When db2_autocommit() receives both the connection parameter and autocommit parameter, it attempts to set the AUTOCOMMIT state of the requested connection to the corresponding state. Gibt bei Erfolg true zurück. Bei einem Fehler wird false zurückgegeben.

Beispiele

Beispiel #1 Retrieving the AUTOCOMMIT value for a connection

In the following example, a connection which has been created with AUTOCOMMIT turned off is tested with the db2_autocommit() function.

<?php
$options 
= array('autocommit' => DB2_AUTOCOMMIT_OFF);
$conn db2_connect($database$user$password$options);
$ac db2_autocommit($conn);
if (
$ac == DB2_AUTOCOMMIT_OFF) {
    print 
"$ac -- AUTOCOMMIT is off.";
} else {
    print 
"$ac -- AUTOCOMMIT is on.";
}
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

0 -- AUTOCOMMIT is off.

Beispiel #2 Setting the AUTOCOMMIT value for a connection

In the following example, a connection which was initially created with AUTOCOMMIT turned off has its behavior changed to turn AUTOCOMMIT on.

<?php
$options 
= array('autocommit' => DB2_AUTOCOMMIT_OFF);
$conn db2_connect($database$user$password$options);

// Turn AUTOCOMMIT on
$rc db2_autocommit($connDB2_AUTOCOMMIT_ON);
if (
$rc) {
    print 
"Turning AUTOCOMMIT on succeeded.\n";
}

// Check AUTOCOMMIT state
$ac db2_autocommit($conn);
if (
$ac == DB2_AUTOCOMMIT_OFF) {
    print 
"$ac -- AUTOCOMMIT is off.";
} else {
    print 
"$ac -- AUTOCOMMIT is on.";
}
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

Turning AUTOCOMMIT on succeeded.
1 -- AUTOCOMMIT is on.

Siehe auch

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Grundlagen von Views in MySQL

Views in einer MySQL-Datenbank bieten die Möglichkeit, eine virtuelle Tabelle basierend auf dem Ergebnis einer SQL-Abfrage zu erstellen. ...

admin

Autor : admin
Kategorie: mySQL-Tutorials

Definition von Stored Procedures - eine Einführung

Stored Procedures sind vordefinierte SQL-Codeblöcke, die in einer Datenbank gespeichert sind und bei Bedarf aufgerufen werden können. ...

Bernie

Autor : ebiz-consult GmbH & Co. KG
Kategorie: mySQL-Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

"How to warm cold entrance?"

What are some effective strategies for addressing the significant heat loss occurring in the entrance hall, which is noticeably the coldest area o ...

Geschrieben von NeerMohan am 01.05.2024 06:49:27
Forum: Fragen/Vorschläge zum Forum
Berechnungen durchführen

Hallo liebe Forenmitglieder, meine erste frage ist zum Aufbau meiner kleinen Berechnungswebseite, nichts kommerzielles, soll nur eine Anwendung f ...

Geschrieben von matze511 am 21.04.2024 21:42:37
Forum: PHP Developer Forum
Professioneller Webentwickler & Webdesigner

Of course, here is the translation: Hello, Thank you for your interest in the long-term project. Your extensive skills and experience in web dev ...

Geschrieben von Athelstan am 15.04.2024 09:25:39
Forum: Jobgesuche
Wir stellen unsere SEO-Agentur vor

Hallo In der heutigen digitalen Welt war es für Unternehmen noch nie so einfach, ihre Reichweite weltweit zu vergrößern. Wenn Sie außerhalb I ...

Geschrieben von thomasmuller am 14.04.2024 07:18:33
Forum: User stellen sich vor