MCPcopy Create free account
hub / github.com/cmoog/vscode-sql-notebook / createMySQLPool

Function createMySQLPool

src/driver.ts:141–171  ·  view source on GitHub ↗
({
  host,
  port,
  user,
  password,
  database,
  multipleStatements,
  queryTimeout,
}: MySQLConfig)

Source from the content-addressed store, hash-verified

139}
140
141async function createMySQLPool({
142 host,
143 port,
144 user,
145 password,
146 database,
147 multipleStatements,
148 queryTimeout,
149}: MySQLConfig): Promise<Pool> {
150 return mysqlPool(
151 mysql.createPool({
152 host,
153 port,
154 user,
155 password,
156 database,
157 multipleStatements,
158 typeCast(field, next) {
159 switch (field.type) {
160 case 'TIMESTAMP':
161 case 'DATE':
162 case 'DATETIME':
163 return field.string();
164 default:
165 return next();
166 }
167 },
168 }),
169 queryTimeout
170 );
171}
172
173function mysqlPool(pool: mysql.Pool, queryTimeout: number): Pool {
174 return {

Callers 1

getPoolFunction · 0.85

Calls 1

mysqlPoolFunction · 0.85

Tested by

no test coverage detected