Skip to content

ODBCDbc

[Source]

ODBCDbc

The class that wraps our ODBC Database handle.

Usage

var env: ODBCEnv = ODBCEnv
var dbc: ODBCDbc = env.dbc()?

// Disable autocommit, set application name, and connect to database
try
  dbc
  .> set_autocommit(false)?         // Disable Autocommit
  .> connect("mydsn")?              // Connect to DSN "mydsn"
else
  Debug.out("We failed.")
end

An example that demonstrates .commit() and .rollback() will be documented in ODBCStmt as that requires an appropriate context to make sense.

class ref ODBCDbc is
  SqlState ref

Implements


Public fields

var dbc: ODBCHandleDbc tag

[Source]


var strict: Bool val

[Source]


Public Functions

stmt

[Source]

Used to create an ODBCStmt object from this ODBCDbc connection.

fun ref stmt()
: ODBCStmt ref ?

Returns


sqlstates

[Source]

Returns an array of SQL States

fun box sqlstates()
: Array[(String val , String val)] val

Returns


get_autocommit

[Source]

Returns whether autocommit is enabled or disabled.

fun ref get_autocommit(
  sl: SourceLoc val = __loc)
: Bool val ?

Parameters

Returns


set_autocommit

[Source]

Enables or disables autocommit. Many RDBMSs require that this be configured before you initiate the actual connection with connect()?

fun ref set_autocommit(
  setting: Bool val,
  sl: SourceLoc val = __loc)
: Bool val ?

Parameters

Returns


commit

[Source]

Instructs the database to commit your transaction and open a new one.

fun ref commit(
  sl: SourceLoc val = __loc)
: Bool val ?

Parameters

Returns


rollback

[Source]

Instructs the database to rollback your transaction and open a new one.

fun ref rollback(
  sl: SourceLoc val = __loc)
: Bool val ?

Parameters

Returns


get_info_varchar

[Source]

SQLGetInfo returns general information about the driver and data source associated with a connection.

fun ref get_info_varchar(
  infotype: U16 val,
  buf: SQLType ref,
  sl: SourceLoc val = __loc)
: Bool val ?

Parameters

Returns


connect

[Source]

Initiates the database connection to the database as defined by the DSN.

fun ref connect(
  dsn: String val,
  sl: SourceLoc val = __loc)
: Bool val ?

Parameters

Returns


disconnect

[Source]

Disconnects the database connection from the database.

fun ref disconnect()
: Bool val ?

Returns