Difference between revisions of "Gambas/libraries/gb.db/Connection"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< Gambas‎ | libraries‎ | gb.db
Jump to navigation Jump to search
 
(updating links to use subpages)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Navigation==
+
==About==
[[computing]]: [[software]]: [[programming]]: [[Gambas]]: [[gb.db]].[[Connection (gb.db)|Connection]]
+
The {{l/same|Connection}} class provides an interface to a particular [[database engine]] connection. It is similar to the Connection interface in [[ADO (Microsoft)|ADO]].
==Overview==
 
The [[gb.db.Connection]] class provides an interface to a particular [[database engine]] connection. It is similar to the Connection interface in [[ADO (Microsoft)|ADO]].
 
 
==Usage==
 
==Usage==
 
To connect to a database server: create a connection object, fill the needed properties, and call the Open method.
 
To connect to a database server: create a connection object, fill the needed properties, and call the Open method.
Line 24: Line 22:
 
|-
 
|-
 
| valign=top |
 
| valign=top |
* [[Charset (gb.db.Connection)|Charset]]
+
* {{l/sub|Charset}}() AS String [[read-only property|(r)]]
* [[Databases (gb.db.Connection)|Databases]]
+
* {{l/sub|Databases}} AS {{l/same|.ConnectionDatabases}}
* [[Host (gb.db.Connection)|Host]]
+
* {{l/sub|Host}} AS String
* [[Login (gb.db.Connection)|Login]]
+
* {{l/sub|Login}} AS String
* [[Name (gb.db.Connection)|Name]]
+
* {{l/sub|Name}} AS String
* [[Password (gb.db.Connection)|Password]]
+
* {{l/sub|Password}} AS String
* [[Port (gb.db.Connection)|Port]]
+
* {{l/sub|Port}} AS String
* [[Tables (gb.db.Connection)|Tables]]
+
* {{l/sub|Tables}} AS {{l/same|.ConnectionTables}}
* [[Type (gb.db.Connection)|Type]]
+
* {{l/sub|Type}} AS String
* [[Users (gb.db.Connection)|Users]]
+
* {{l/sub|Users}} AS {{l/same|.ConnectionUsers}}
* [[Version (gb.db.Connection)|Version]]
+
* {{l/sub|Version}} AS Integer [[read-only property|(r)]]
 
| valign=top |
 
| valign=top |
* [[Begin (gb.db.Connection)|Begin]]
+
* {{l/sub|Begin}}()
* [[Close (gb.db.Connection)|Close]]
+
* {{l/sub|Close}}()
* [[Commit (gb.db.Connection)|Commit]]
+
* {{l/sub|Commit}}()
* [[Create (gb.db.Connection)|Create]]
+
* {{l/sub|Create}}( <u>Table</u> AS String ) AS {{l/same|Result}}
* [[Edit (gb.db.Connection)|Edit]]
+
* {{l/sub|Edit}}( <u>Table</u> AS String {{optargs|, <u>Request</u> AS String, <u>Arguments</u> AS , ...}} ) AS {{l/same|Result}}
* [[Exec (gb.db.Connection)|Exec]]
+
* {{l/sub|Exec}}( <u>Request</u> AS String, Arguments AS {{optargs|, ...}} ) AS {{l/same|Result}}
* [[Find (gb.db.Connection)|Find]]
+
* {{l/sub|Find}}( <u>Table</u> AS String {{optargs|, <u>Request</u> AS String, <u>Arguments</u> AS , ...}} ) AS {{l/same|Result}}
* [[Open (gb.db.Connection)|Open]]
+
* {{l/sub|Open}}() AS Boolean
* [[Quote (gb.db.Connection)|Quote]]
+
* {{l/sub|Quote}}( <u>Name</u> AS String ) AS String
* [[Rollback (gb.db.Connection)|Rollback]]
+
* {{l/sub|Rollback}}()
 
|}
 
|}
 +
==Links==
 +
===Reference===
 +
* [http://gambasdoc.org/help/comp/gb.db/connection Gambas Documentation]

Latest revision as of 20:24, 24 April 2013

About

The Connection class provides an interface to a particular database engine connection. It is similar to the Connection interface in ADO.

Usage

To connect to a database server: create a connection object, fill the needed properties, and call the Open method.

For SQLite connections, the following algorithm is used:

  • If Name is null, then a memory database is opened.
  • If Name is an absolute path, then this path is used.
  • If Name is a relative path, then:
    • If Host is null, then the database is located in the application temporary directory, which is /tmp/gambas.$UID/sqlite .
    • Otherwise, Host gives the database directory, and the database path is the result of concatenating Host and Name.

This class is creatable:

DIM hConnection AS Connection
hConnection = NEW Connection ( ) 

Identifiers

Properties Methods
  1. REDIRECT Template:arg/opt ) AS Result
  • Exec( Request AS String, Arguments AS
  1. REDIRECT Template:fmt/arg/opt ) AS Result
  • Find( Table AS String [ <, Request AS String, Arguments AS , ...> ] ) AS Result
  • Open() AS Boolean
  • Quote( Name AS String ) AS String
  • Rollback()

Links

Reference