You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2c19dcd
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/streaming.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,6 +95,30 @@ $r = $client->streamRead(
95
95
);
96
96
```
97
97
98
+
## readWithParams
99
+
100
+
Stream query results using native ClickHouse typed parameters (`{name:Type}` syntax). Combines the safety of server-side parameter binding with streaming output:
101
+
102
+
```php
103
+
$stream = fopen('php://memory', 'r+');
104
+
$streamRead = new ClickHouseDB\Transport\StreamRead($stream);
105
+
106
+
$client->readWithParams(
107
+
$streamRead,
108
+
'SELECT id, name FROM users WHERE id = {id:UInt32} FORMAT JSONEachRow',
109
+
['id' => 1]
110
+
);
111
+
112
+
rewind($stream);
113
+
while (($line = fgets($stream)) !== false) {
114
+
$row = json_decode(trim($line), true);
115
+
echo $row['name'];
116
+
}
117
+
fclose($stream);
118
+
```
119
+
120
+
The FORMAT clause must be specified in the SQL. See [native-params](native-params) for supported parameter types.
121
+
98
122
## Direct write to file
99
123
100
124
Send ClickHouse results directly to a file without JSON parsing:
0 commit comments