MCPcopy
hub / github.com/prisma/prisma / normalizeMySQLConnectionString

Function normalizeMySQLConnectionString

packages/cli/src/Studio.ts:392–412  ·  view source on GitHub ↗
(connectionString: string)

Source from the content-addressed store, hash-verified

390}
391
392function normalizeMySQLConnectionString(connectionString: string): string {
393 const connectionURL = new URL(connectionString)
394
395 const connectionLimit = connectionURL.searchParams.get('connection_limit')
396
397 if (connectionLimit && !connectionURL.searchParams.has('connectionLimit')) {
398 connectionURL.searchParams.set('connectionLimit', connectionLimit)
399 }
400
401 const sslAccept = connectionURL.searchParams.get('sslaccept')
402
403 if (sslAccept && !connectionURL.searchParams.has('ssl')) {
404 connectionURL.searchParams.set('ssl', JSON.stringify(prismaSslAcceptToMySQL2Ssl(sslAccept)))
405 }
406
407 for (const queryParameter of PRISMA_ORM_SPECIFIC_MYSQL_QUERY_PARAMETERS) {
408 connectionURL.searchParams.delete(queryParameter)
409 }
410
411 return connectionURL.toString()
412}
413
414function prismaSslAcceptToMySQL2Ssl(sslAccept: string): { rejectUnauthorized: boolean } {
415 switch (sslAccept) {

Callers 1

createExecutorFunction · 0.85

Calls 6

hasMethod · 0.80
setMethod · 0.80
deleteMethod · 0.80
getMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected