SQL Yoga version 1.1.0 build 4 :: Visit website

Printer friendly version

command dbconn_set

Sets properties for a Database Connection Object.

command dbconn_set pProp, pValue
Parameters
TypeNameDescription
Simple parameter. pProp The property of the Connection to set.
Simple parameter. pValue The value to set the property to.
OptionalSimple parameter. [pConnName] The name of a Database Connection. The default is the "default connection" for the Database Object.
OptionalSimple parameter. [pDBKey] Database Object connection is associated with. Default is name returned by sqlyoga_getDefaultDatabase().
Description

Properties:

adaptor: The adaptor to use to connect to the database: mysql, odbc, postgresql, sqlite, valentina.

dsn: The DSN you would like to connect to. Used with ODBC and maps to the "host" property.

database name: The name of the database on the server. For sqlite this and the 'file' property are synonymous.

file: For SQLite databases this is the path to the database file on disk. Synonymous with 'database name'.

host: The host for your database.

last executed sql: The last SQL statement that was executed using this database connection.

log field: A reference to a field where all SQL statements that are executed will be logged. For debugging purposes.

log file: A file path where all SQL statements that are executed will be logged. For debugging purposes.

password: Password required to connect to the database.

port: Port to connect to the database over. Default values for each platform are implied.

quote identifiers: Set to true to have SQL Yoga add quotes around every table/field name in queries. Default is false.

type: The type of database that this connection is associated with. Only applies if the adaptor is set to "odbc": sql server, mysql, postgresql.

username: Username used to connect to the database.

use ssl: Set to true to connect to the database using SSL. Currently supported with MySQL and Valentina client.

Examples:

## SQLite Example 
dbconn_set "file", thePathToDatabaseFile

## MySQL Example
dbconn_set "host", "localhost"
dbconn_set "username", "root"
dbconn_set "password", empty
dbconn_set "database name", "sql_yoga_test"

## ODBC Example
-- Note: When calling dbconn_createObject you pass in 3 parameters
-- The 2nd is "odbc" and the 3rd is the type of database you are
-- connection too
-- dbconn_createObject "development", "odbc", "sql server"
dbconn_set "dsn", "sqlserver_odbc"
dbconn_set "username", "odbc_user"
dbconn_set "password", empty

## Local Valentina Example
dbconn_set "file", theDatabase
dbconn_setVendor "valentina", "mac serial number", MyValMacSerialNumber
dbconn_setVendor "valentina", "win serial number", MyValWinSerialNumber
dbconn_setVendor "valentina", "unix serial number", MyValUnixSerialNumber
dbconn_setVendor "valentina", "encryption key", MyEncryptionKey

## Valentina Client Example
dbconn_set "host", "localhost"
dbconn_set "username", "sa"
dbconn_set "password", "sa"
dbconn_set "use ssl", true
dbconn_set "database name", "my database.vdb"

Return

empty