事务操作Transaction
方法: inTransaction()
,beginTransaction()
,commit()
,rollBack()
try {
$db->beginTransaction();
$db->table('products')->insert([
'name' => 'Apple Iphone X 128 Gb',
'code' => 'APPLEX128',
'price' => '999.9'
]);
$db->table('images')->insert([
'productId' => $db->lastInsertId(),
'imageName' => 'foo.jpg'
]);
$db->commit();
} catch(Exception $e) {
$db->rollBack();
}
结构维护Structure
方法有: truncate()
,drop()
,optimize()
,analyze()
,check()
,checksum()
,repair()
$db->repair('sessions');