Documentation
¶
Index ¶
- func Exec(conn *sql.DB, query string) (sql.Result, error)
- func FormatTabular(headers []string, rows [][]string) string
- func Open(host string, port int, user, password, database string, allowOldPasswords bool) (*sql.DB, error)
- func Ping(conn *sql.DB) error
- func Query(conn *sql.DB, query string) ([]string, [][]string, error)
- func SplitStatements(sqlText string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatTabular ¶
FormatTabular formats query results as mysql-style tabular output. This allows reuse of the existing mask/format/parse infrastructure.
func Open ¶
func Open(host string, port int, user, password, database string, allowOldPasswords bool) (*sql.DB, error)
Open opens a MySQL connection using go-sql-driver/mysql. If allowOldPasswords is true, the pre-4.1 old_password authentication is enabled. This should only be used for legacy MySQL 4.x connections.
func SplitStatements ¶ added in v0.3.2
SplitStatements splits a SQL string into individual statements by semicolons, respecting single-quoted, double-quoted, and backtick-quoted strings, as well as line comments (--) and block comments (/* */). Empty statements are skipped.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.