File tree Expand file tree Collapse file tree 2 files changed +10
-12
lines changed
Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change 11<?php
22
3- use Clue \React \SQLite \Factory ;
4- use Clue \React \SQLite \Result ;
5-
63require __DIR__ . '/../vendor/autoload.php ' ;
74
8- $ factory = new Factory ();
5+ $ factory = new Clue \ React \ SQLite \ Factory ();
96
107$ n = isset ($ argv [1 ]) ? $ argv [1 ] : 1 ;
118$ db = $ factory ->openLazy ('test.db ' );
1411$ promise ->then (null , 'printf ' );
1512
1613for ($ i = 0 ; $ i < $ n ; ++$ i ) {
17- $ db ->exec ("INSERT INTO foo (bar) VALUES ('This is a test') " )->then (function (Result $ result ) {
14+ $ db ->exec ("INSERT INTO foo (bar) VALUES ('This is a test') " )->then (function (Clue \ React \ SQLite \ Result $ result ) {
1815 echo 'New row ' . $ result ->insertId . PHP_EOL ;
16+ }, function (Exception $ e ) {
17+ echo 'Error: ' . $ e ->getMessage () . PHP_EOL ;
1918 });
2019}
2120
Original file line number Diff line number Diff line change 11<?php
22
3- use Clue \React \SQLite \DatabaseInterface ;
4- use Clue \React \SQLite \Factory ;
5- use Clue \React \SQLite \Result ;
6-
73require __DIR__ . '/../vendor/autoload.php ' ;
84
9- $ factory = new Factory ();
5+ $ factory = new Clue \ React \ SQLite \ Factory ();
106
117$ search = isset ($ argv [1 ]) ? $ argv [1 ] : 'foo ' ;
128$ db = $ factory ->openLazy ('test.db ' );
139
14- $ db ->query ('SELECT * FROM foo WHERE bar LIKE ? ' , ['% ' . $ search . '% ' ])->then (function (Result $ result ) {
10+ $ db ->query ('SELECT * FROM foo WHERE bar LIKE ? ' , ['% ' . $ search . '% ' ])->then (function (Clue \ React \ SQLite \ Result $ result ) {
1511 echo 'Found ' . count ($ result ->rows ) . ' rows: ' . PHP_EOL ;
1612 echo implode ("\t" , $ result ->columns ) . PHP_EOL ;
1713 foreach ($ result ->rows as $ row ) {
1814 echo implode ("\t" , $ row ) . PHP_EOL ;
1915 }
20- }, 'printf ' );
16+ }, function (Exception $ e ) {
17+ echo 'Error: ' . $ e ->getMessage () . PHP_EOL ;
18+ });
19+
2120$ db ->quit ();
You can’t perform that action at this time.
0 commit comments