Skip to content

mssql #

SQL Server ODBC

The mssql module has been moved to db.mssql. Update your code to do: import db.mssql instead.

struct Config #

struct Config {
pub:
	driver string
	server string
	uid    string
	pwd    string
// if dbname empty, conn str will not contain Database info,
// and it is up to the server to choose which db to connect to.
	dbname string
}

fn (Config) get_conn_str #

fn (cfg Config) get_conn_str() string

struct Connection #

struct Connection {
mut:
	henv C.SQLHENV = C.SQLHENV(C.SQL_NULL_HENV) // Environment
	hdbc C.SQLHDBC = C.SQLHDBC(C.SQL_NULL_HDBC) // Connection handle
pub mut:
	conn_str string
}

fn (Connection) connect #

fn (mut conn Connection) connect(conn_str string) !bool

connect to db

fn (Connection) close #

fn (mut conn Connection) close()

close - closes the connection.

fn (Connection) query #

fn (mut conn Connection) query(q string) !Result

query executes a sql query

struct Result #

struct Result {
pub mut:
	rows []Row
// the number of rows affected by sql statement
	num_rows_affected int
}

struct Row #

struct Row {
pub mut:
	vals []string
}