| Package | phi.interfaces |
| Interface | public interface IDatabase |
| Implementors | Database |
Database object.
A IDatabase implementor have these responsibilities:
IQuery to access classes on a remote application server and execute a SQL statements.See also
| Property | Defined by | ||
|---|---|---|---|
| connection : ConnectionData
[write-only]
| IDatabase | ||
| Method | Defined by | ||
|---|---|---|---|
|
connect(name:String, user:String, pass:String, host:String, db:String, bDefault:Boolean = false):void
Create a new connection with a remote application server.
| IDatabase | ||
|
disconnect(name:String):void
Disconnect from a previous connection
| IDatabase | ||
|
getConnections():Number
Get the number of current open connections.
| IDatabase | ||
|
getDefaultConnectionName():String
Get the default connection name
| IDatabase | ||
|
retrieveConnection(connectionName:String):ConnectionData
Retrieve an connection information.
| IDatabase | ||
|
setDefaultConnection(name:String):void
Set a connection as a default
| IDatabase | ||
| connection | property |
connection:ConnectionData [write-only]Implementation
public function set connection(value:ConnectionData):void
| connect | () | method |
public function connect(name:String, user:String, pass:String, host:String, db:String, bDefault:Boolean = false):void
Create a new connection with a remote application server. This
connection can be use for execute SQL statements to a database.
More then one connection can be made but you must enter at least
one connection for the Database object to work.
name:String — the name of the connection
|
|
user:String — the username of the remote application server
|
|
pass:String — the password of the remote application server
|
|
host:String — the server ip
|
|
db:String — the database name
|
|
bDefault:Boolean (default = false) — set this connection as a default connection
|
— Error if a connection with the same name allready exist.
|
var db:IDatabase = Database.getInstance();
db.connect("conn1", "pop", "poppass", "localhost", "yb20");
db.connect("conn2", "pop", "poppass", "localhost", "test_db");
| disconnect | () | method |
public function disconnect(name:String):voidDisconnect from a previous connection
Parametersname:String — the name of the connection
|
— Error if the connection don't exist.
|
| getConnections | () | method |
public function getConnections():NumberGet the number of current open connections.
ReturnsNumber — the number of current open connections.
|
| getDefaultConnectionName | () | method |
public function getDefaultConnectionName():StringGet the default connection name
ReturnsString — a string with the name of the default connection
|
| retrieveConnection | () | method |
public function retrieveConnection(connectionName:String):ConnectionDataRetrieve an connection information.
ParametersconnectionName:String — the name of the connection to retrieve.
|
ConnectionData —
an ConnectionData instance previously created with the connect function.
|
— Error if the connection don't exist.
|
| setDefaultConnection | () | method |
public function setDefaultConnection(name:String):voidSet a connection as a default
Parametersname:String — the connection name
|