File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,6 +44,32 @@ public function __construct()
4444 $ this ->mount ();
4545 }
4646
47+ public function autoCommit (int $ value ): DB
48+ {
49+ $ statement = sprintf ("SET AUTOCOMMIT = %u; " , $ value );
50+ if (!$ this ->fire ($ statement ))
51+ {
52+ return false ;
53+ }
54+
55+ $ this ->dump ();
56+
57+ return $ this ;
58+ }
59+
60+ public function begin (): DB
61+ {
62+ $ statement = "BEGIN; " ;
63+ if (!$ this ->fire ($ statement ))
64+ {
65+ return false ;
66+ }
67+
68+ $ this ->dump ();
69+
70+ return $ this ;
71+ }
72+
4773 protected function buildInsert (array $ data , $ modifiers =null , $ upsert =false ): string
4874 {
4975 if ($ modifiers )
@@ -167,7 +193,20 @@ protected function buildWhere(): string
167193
168194 return join (' AND ' , $ tmp );
169195 }
170-
196+
197+ public function commit (): DB
198+ {
199+ $ statement = "COMMIT; " ;
200+ if (!$ this ->fire ($ statement ))
201+ {
202+ return false ;
203+ }
204+
205+ $ this ->dump ();
206+
207+ return $ this ;
208+ }
209+
171210 public static function config (string $ filename )
172211 {
173212 self ::$ config = $ filename ;
@@ -470,6 +509,19 @@ public function rightJoin(string $table, string $conditions): DB
470509 return $ this ;
471510 }
472511
512+ public function rollback (): DB
513+ {
514+ $ statement = "ROLLBACK; " ;
515+ if (!$ this ->fire ($ statement ))
516+ {
517+ return false ;
518+ }
519+
520+ $ this ->dump ();
521+
522+ return $ this ;
523+ }
524+
473525 public function select (string $ value =null ): DB
474526 {
475527 $ this ->select = $ value ;
You can’t perform that action at this time.
0 commit comments