Connection
ODBC database connection
Operations
- New
- Close
- Commit
- CreateParameterStatement
- GetColumns
- GetLastError
- GetTables
- IsOpen
- Rollback
- Select
- SetAutoCommit
- Update
Commit
Commits the current transaction.
method : public : Commit() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if successful |
CreateParameterStatement
Create a parametrized SQL statement
method : public : CreateParameterStatement(sql:String) ~ ParameterStatementParameters
| Name | Type | Description |
|---|---|---|
| sql | String | SQL statement |
Return
| Type | Description |
|---|---|
| ParameterStatement | result set |
GetColumns
Gets column information for a table as name:type pairs.
method : public : GetColumns(table:String) ~ String[]Parameters
| Name | Type | Description |
|---|---|---|
| table | String | table name |
Return
| Type | Description |
|---|---|
| String | array of column descriptors (name:type), or Nil on failure |
GetLastError
Gets the last error message from the connection.
method : public : GetLastError() ~ StringReturn
| Type | Description |
|---|---|
| String | error message string, or empty if no error |
GetTables
Gets the list of table names in the data source.
method : public : GetTables() ~ String[]Return
| Type | Description |
|---|---|
| String | array of table names, or Nil on failure |
IsOpen
Check rather a connect is open
method : public : IsOpen() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if connected, false otherwise |
New
Constructor
New(ds:String, username:String, password:String)Parameters
| Name | Type | Description |
|---|---|---|
| ds | String | ODBC data source |
| username | String | ODBC connection name |
| password | String | ODBC connection password |
New
Constructor using a connection string
New(conn_str:String)Parameters
| Name | Type | Description |
|---|---|---|
| conn_str | String | ODBC connection string (e.g. "Driver={SQL Server};Server=localhost;Database=mydb;Uid=user;Pwd=pass;") |
Rollback
Rolls back the current transaction.
method : public : Rollback() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if successful |
Select
Executes a SQL select statement
method : public : Select(sql:String) ~ ResultSetParameters
| Name | Type | Description |
|---|---|---|
| sql | String | SQL statement |
Return
| Type | Description |
|---|---|
| ResultSet | result set |