Skip to content

Commit aaff00d

Browse files
committed
Update README
1 parent 953c122 commit aaff00d

3 files changed

Lines changed: 15 additions & 16 deletions

File tree

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,10 @@ function main(): void
6161
$pool->execute('INSERT INTO logs (message) VALUES (?)', ["Log entry $i"])->await();
6262
});
6363
}
64-
Thread::await();
65-
});
6664

67-
// Clean up
68-
$pool->closeAll()->await();
65+
// Clean up
66+
$pool->closeAll()->await();
67+
});
6968
}
7069
```
7170

@@ -101,10 +100,8 @@ function main(): void
101100
Launch::new(function () use ($pool) {
102101
$result = $pool->query('SELECT * FROM users LIMIT 10')->await();
103102
});
104-
Thread::await();
103+
$pool->closeAll()->await();
105104
});
106-
107-
$pool->closeAll()->await();
108105
}
109106
```
110107

tests/test_mysql.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
use vosaka\foroutines\AsyncMain;
1010

1111
#[AsyncMain]
12-
function main(): void
13-
{
14-
$conn = new AsyncMysqlPool('127.0.0.1', 3307, 'testuser', 'testpass', 'shop');
12+
function main(): void {
13+
$conn = new AsyncMysqlPool('127.0.0.1', 3307, 'testuser', 'testpass', 'shop');
1514

16-
$result = $conn->query('SELECT * FROM users', [1])->await();
17-
foreach ($result->rows as $row) {
18-
var_dump($row);
19-
}
15+
$result = $conn->query('SELECT * FROM users', [1])->await();
16+
foreach ($result->rows as $row) {
17+
var_dump($row);
18+
}
2019

21-
$result = $conn->execute('INSERT INTO users (name) VALUES (?)', ['Nam'])->await();
22-
echo $result->lastInsertId;
20+
$result = $conn->execute('INSERT INTO users (name) VALUES (?)', ['Nam'])->await();
21+
echo $result->lastInsertId;
22+
$conn->closeAll()->awaitAll();
2323
}

tests/test_pgsql.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ function main(): void {
2222
)->await();
2323

2424
echo $result->lastInsertId;
25+
26+
$conn->closeAll()->awaitAll();
2527
}

0 commit comments

Comments
 (0)