57 require_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
58 ilUnitUtil::performInitialisation();
60 global $ilClientIniFile;
62 $this->ilDBInterfaceGalera->initFromIniFile($ilClientIniFile);
63 $this->ilDBInterfaceGalera->connect();
66 $this->ilDBInterfaceGaleraSecond->initFromIniFile($ilClientIniFile);
67 $this->ilDBInterfaceGaleraSecond->connect();
70 $this->ilDBInterfaceInnoDB->initFromIniFile($ilClientIniFile);
71 $this->ilDBInterfaceInnoDB->connect();
74 $this->ilDBInterfaceInnoDBSecond->initFromIniFile($ilClientIniFile);
75 $this->ilDBInterfaceInnoDBSecond->connect();
82 $this->ilDBInterfaceGalera->dropSequence(
'il_db_tests_atom');
83 $this->ilDBInterfaceGalera->dropTable(
'il_db_tests_atom');
88 $this->assertTrue($this->ilDBInterfaceGalera->connect(
true));
89 $this->assertTrue($this->ilDBInterfaceGaleraSecond->connect(
true));
90 $this->assertTrue($this->ilDBInterfaceInnoDB->connect(
true));
95 if ($this->ilDBInterfaceGalera->sequenceExists(
'il_db_tests_atom')) {
96 $this->ilDBInterfaceGalera->dropSequence(
'il_db_tests_atom');
98 $this->ilDBInterfaceGalera->createTable(
'il_db_tests_atom', $fields =
array(
104 'is_online' =>
array(
110 $this->ilDBInterfaceGalera->addPrimaryKey(
'il_db_tests_atom',
array(
'id' ));
111 $this->ilDBInterfaceGalera->createSequence(
'il_db_tests_atom');
116 $this->assertTrue($this->ilDBInterfaceGalera->tableExists(
'il_db_tests_atom'));
121 $ilAtomQuery = $this->ilDBInterfaceGalera->buildAtomQuery();
122 $ilAtomQuery->addTableLock(
'il_db_tests_atom')->lockSequence(
true);
132 $ilAtomQuery = $this->ilDBInterfaceInnoDB->buildAtomQuery();
133 $ilAtomQuery->addTableLock(
'il_db_tests_atom')->lockSequence(
true);
143 $ilAtomQuery = $this->ilDBInterfaceInnoDB->buildAtomQuery();
144 $ilAtomQuery->addTableLock(
'il_db_tests_atom')->lockSequence(
true)->aliasName(
'my_alias');
154 $ilAtomQuery = $this->ilDBInterfaceInnoDB->buildAtomQuery();
155 $ilAtomQuery->addTableLock(
'il_db_tests_atom')->lockSequence(
true)->aliasName(
'my_alias');
156 $ilAtomQuery->addTableLock(
'il_db_tests_atom')->lockSequence(
true)->aliasName(
'my_second_alias');
166 $ilAtomQuery = $this->ilDBInterfaceInnoDB->buildAtomQuery();
167 $ilAtomQuery->addTableLock(
'il_db_tests_atom')->lockSequence(
true);
168 $ilAtomQuery->addTableLock(
'il_db_tests_atom')->lockSequence(
true)->aliasName(
'my_alias');
178 $this->setExpectedException(
'ilDatabaseException');
179 $ilAtomQuery = $this->ilDBInterfaceInnoDB->buildAtomQuery();
187 $this->setExpectedException(
'ilDatabaseException');
188 $ilAtomQuery = $this->ilDBInterfaceInnoDB->buildAtomQuery();
189 $ilAtomQuery->addTableLock(
'il_db_tests_atom');
196 $this->ilDBInterfaceGalera->insert(
'il_db_tests_atom',
array(
197 'id' =>
array(
'integer', $this->ilDBInterfaceGalera->nextId(
'il_db_tests_atom') ),
198 'is_online' =>
array(
'integer', 1 ),
202 $this->ilDBInterfaceGalera->beginTransaction();
203 $this->ilDBInterfaceGalera->update(
'il_db_tests_atom',
array(
204 'is_online' =>
array(
'integer', 5 ),
213 $this->ilDBInterfaceGalera->commit();
216 $query =
'SELECT is_online FROM il_db_tests_atom WHERE id = ' . $this->ilDBInterfaceGalera->quote(1,
'integer');
217 $res = $this->ilDBInterfaceGalera->query(
$query);
218 $d = $this->ilDBInterfaceGalera->fetchAssoc(
$res);
220 $this->assertEquals(5,
$d[
'is_online']);
225 $this->ilDBInterfaceInnoDB->insert(
'il_db_tests_atom',
array(
226 'id' =>
array(
'integer', $this->ilDBInterfaceInnoDB->nextId(
'il_db_tests_atom') ),
227 'is_online' =>
array(
'integer', 1 ),
231 $this->ilDBInterfaceInnoDB->update(
'il_db_tests_atom',
array(
232 'is_online' =>
array(
'integer', 5 ),
241 $this->ilDBInterfaceInnoDB->unlockTables();
244 $query =
'SELECT is_online FROM il_db_tests_atom WHERE id = ' . $this->ilDBInterfaceInnoDB->quote(1,
'integer');
245 $res = $this->ilDBInterfaceInnoDB->query(
$query);
246 $d = $this->ilDBInterfaceInnoDB->fetchAssoc(
$res);
248 $this->assertEquals(5,
$d[
'is_online']);
263 'id' =>
array(
'integer',
$ilDB->nextId(
'il_db_tests_atom') ),
264 'is_online' =>
array(
'integer', 1 ),
267 'id' =>
array(
'integer',
$ilDB->nextId(
'il_db_tests_atom') ),
268 'is_online' =>
array(
'integer', 0 ),
282 'name' =>
'il_db_tests_atom',
296 $res = $this->ilDBInterfaceGalera->query(
'SELECT * FROM il_db_tests_atom');
298 while (
$d = $this->ilDBInterfaceGalera->fetchAssoc(
$res)) {
getTableLocksForDbInterface()
testWriteWithTransactions()
TestCase for the ilDatabaseAtomBaseTest.
$ilDBInterfaceGaleraSecond
for($col=0; $col< 50; $col++) $d
const TYPE_PDO_MYSQL_INNODB
testWriteWithMultipleLocksAndAlias()
testUpdateDuringTransaction()
Create styles array
The data for the language used.
testWriteWithMultipleLocksWithAndWithoutAlias()
testWriteWithLocksAndAlias()
$ilDBInterfaceInnoDBSecond