1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/mssql
2021-05-31 14:08:31 +03:00
..
_cdef_nix.c.v vlib: add a vlib/mssql module (#10280) 2021-05-31 14:08:31 +03:00
_cdef_windows.c.v vlib: add a vlib/mssql module (#10280) 2021-05-31 14:08:31 +03:00
_cdefs.c.v vlib: add a vlib/mssql module (#10280) 2021-05-31 14:08:31 +03:00
config.v vlib: add a vlib/mssql module (#10280) 2021-05-31 14:08:31 +03:00
mssql.v vlib: add a vlib/mssql module (#10280) 2021-05-31 14:08:31 +03:00
README.md vlib: add a vlib/mssql module (#10280) 2021-05-31 14:08:31 +03:00
result.v vlib: add a vlib/mssql module (#10280) 2021-05-31 14:08:31 +03:00
stmt_handle.v vlib: add a vlib/mssql module (#10280) 2021-05-31 14:08:31 +03:00

SQL Server ODBC

  • This is a V wrapper of SQL Server ODBC C/C++ library

Dependencies

TODO

  • Support Windows
  • Support Mac
  • ORM

Usage

import mssql

fn test_example() ? {
	// connect to server
	config := mssql.Config{
		driver: 'ODBC Driver 17 for SQL Server'
		server: 'tcp:localhost'
		uid: '<your username>'
		pwd: '<your password>'
	}

	mut conn := mssql.Connection{}

	conn.connect(config.get_conn_str()) ?

	defer {
		conn.close()
	}

	// get current db name
	mut query := 'SELECT DB_NAME()'
	mut res := conn.query(query) ?
	assert res == mssql.Result{
		rows: [mssql.Row{
			vals: ['master']
		}]
		num_rows_affected: -1
	}
}