Open
Description
Other drivers, in particular modernc and ncruces support a generic _pragma
URI parameter.
Basically, potentially multiple PRAGMA statements are executed in the order specified in the URI for every connection opened.
Example:
sql.Open("sqlite3", "file:demo.db?_pragma=busy_timeout(10000)&_pragma=foreign_keys(on)")
This leads to the following SQL being executed:
PRAGMA busy_timeout(10000);
PRAGMA foreing_keys(on);
The values of the _pragma
params are reproduced literally after URL decoding. Using the parenthesis form of PRAGMA
is just a convenience for readability (_pragma=busy_timeout%3D10000
would be just as valid).
These would serve the same purpose as many of the custom parameters this driver specifies (like _fk
), but would be more portable across drivers, allowing libraries like GORM, goqite or redka to be driver agnostic and customize their connections in a driver agnostic way.
Metadata
Metadata
Assignees
Labels
No labels