Mysql
 sql >> Teknologi Basis Data >  >> RDS >> Mysql

Tidak dapat melihat baris yang disisipkan oleh transaksi yang sedang berjalan saat tingkat isolasi READ_UNCOMMITTED

Dengan skrip pengujian kecil saya, tidak ada catatan yang muncul sebelum komit jika saya masuk dari konsol lain. Saya dapat memilih catatan yang baru saja dimasukkan dalam sesi yang sama. Jadi saya berasumsi bahwa sebelum komit, Anda mungkin mengakses baris yang sudah ada di tabel, tetapi sekarang baris atau perubahan baru sebelum dikomit.

<?php

require_once('db.php');

q( 'drop table if exists t' );
q( 'create table t (id integer not null auto_increment primary key, v datetime) engine=innodb' );

q( 'set transaction isolation level read uncommitted' );
q( 'start transaction' );
q( 'insert into t (v) values (now()),(now()),(now())' );

echo q1( 'count(*)', 't', 'true'); // translates to "select count(*) from t where true"; 
// echoes "3" to the console

// wait for input
$handle = fopen ("php://stdin","r");
$line = fgets($handle);

// with a mysql client from a 2nd console at this point no new records show in table t

q( 'commit' );

// after this point all new records show up in table t from a 2nd session.



  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Kebocoran memori di JDBC4Connection

  2. mysql - tampilkan nilai yang ada di SEMUA tabel

  3. Kueri JPA dalam beberapa tabel dengan hubungan banyak ke banyak

  4. Cara Memperbarui Banyak Kolom di MySQL

  5. MySQL:Bagaimana cara memasukkan catatan untuk setiap hasil dalam kueri SQL?