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
Copy file name to clipboardExpand all lines: README.md
-81Lines changed: 0 additions & 81 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,87 +24,6 @@ MySql client for node.js. Written in native JavaScript and aims to be mostly api
24
24
## Documentation
25
25
26
26
27
-
### Named placeholders
28
-
29
-
You can use named placeholders for parameters by setting `namedPlaceholders` config value or query/execute time option. Named placeholders are converted to unnamed `?` on the client (mysql protocol does not support named parameters). If you reference parameter multiple times under the same name it is sent to server multiple times.
/* results will be an array of arrays like this now:
53
-
[[
54
-
'field A value',
55
-
'field B value',
56
-
'field C value',
57
-
'field D value',
58
-
], ...]
59
-
*/
60
-
});
61
-
```
62
-
63
-
### Sending tabular data with 'load infile' and local stream:
64
-
65
-
In addition to sending local fs files you can send any stream using `infileStreamFactory` query option. If set, it has to be a function that return a readable stream. It gets file path from query as a parameter.
66
-
67
-
```js
68
-
// local file
69
-
connection.query('LOAD DATA LOCAL INFILE "/tmp/data.csv" INTO TABLE test FIELDS TERMINATED BY ? (id, title)', onInserted1);
70
-
// local stream
71
-
var sql ='LOAD DATA LOCAL INFILE "mystream" INTO TABLE test FIELDS TERMINATED BY ? (id, title)';
stream:net.connect('/tmp/mysql.sock').pipe(shape(10)) // emulate 10 bytes/sec link
88
-
});
89
-
connection.query('SELECT 1+1 as test1', console.log);
90
-
```
91
-
`stream` also can be a function. In that case function result has to be duplex stream, and it is used for connection transport. This is required if you connect pool using custom transport as new pooled connection needs new stream. [Example](https://github.com/sidorares/node-mysql2/issues/80) connecting over socks5 proxy:
In addition to password `createConnection()`, `createPool()` and `changeUser()` accept `passwordSha1` option. This is useful when implementing proxies as plaintext password might be not available.
107
-
108
27
## Known incompatibilities with node-mysql
109
28
110
29
In contrast to node-mysql, `zeroFill` flag is ignored in type conversion.
You can use named placeholders for parameters by setting `namedPlaceholders` config value or query/execute time option. Named placeholders are converted to unnamed `?` on the client (mysql protocol does not support named parameters). If you reference parameter multiple times under the same name it is sent to server multiple times.
/* results will be an array of arrays like this now:
29
+
[[
30
+
'field A value',
31
+
'field B value',
32
+
'field C value',
33
+
'field D value',
34
+
], ...]
35
+
*/
36
+
});
37
+
```
38
+
39
+
## Sending tabular data with 'load infile' and local stream:
40
+
41
+
In addition to sending local fs files you can send any stream using `infileStreamFactory` query option. If set, it has to be a function that return a readable stream. It gets file path from query as a parameter.
42
+
43
+
```js
44
+
// local file
45
+
connection.query('LOAD DATA LOCAL INFILE "/tmp/data.csv" INTO TABLE test FIELDS TERMINATED BY ? (id, title)', onInserted1);
46
+
// local stream
47
+
var sql ='LOAD DATA LOCAL INFILE "mystream" INTO TABLE test FIELDS TERMINATED BY ? (id, title)';
stream:net.connect('/tmp/mysql.sock').pipe(shape(10)) // emulate 10 bytes/sec link
64
+
});
65
+
connection.query('SELECT 1+1 as test1', console.log);
66
+
```
67
+
`stream` also can be a function. In that case function result has to be duplex stream, and it is used for connection transport. This is required if you connect pool using custom transport as new pooled connection needs new stream. [Example](https://github.com/sidorares/node-mysql2/issues/80) connecting over socks5 proxy:
In addition to password `createConnection()`, `createPool()` and `changeUser()` accept `passwordSha1` option. This is useful when implementing proxies as plaintext password might be not available.
0 commit comments