PhpOrient - dbOpen()
This method opens a database on the client interface. The return value is a cluster map.
Opening Databases
When the database you want exists already on the OrientDB Server, you can open it on the client interface using this method with the appropriate name and login credentials. Once you have it open, a series of additional methods become available through the client interface. These allow you to insert, retrieve and modify records in the database.
Syntax
$client->dbOpen('<database-name>', '<user>', '<password>')
<database-name>
Defines the database you want to open.<user>
Defines the user you want to access the database.<password>
Defines the password to use.
Example
For instance, in the use case of web application, you might use something like this to connect to the database.
// CONNECT TO DATABASE
$ClusterMap = $client->dbOpen('GratefulDeadConcerts', 'admin', 'admin_passwd');
Working with Database
Once you have an open database on the client interface, a series of additional methods become available to you. These methods handle common operations on the database, in terms of inserting and fetching records as well as manipulating clusters on the database.
Method | Description |
---|---|
command() | Executes a command on the database. |
dataClusterAdd() | Adds a cluster to the database. |
dataClusterCount() | Counts records in a cluster or clusters. |
dataClusterDrop() | Removes a cluster from the database. |
dataClusterDataRange() | retrieves a range of Record ID's for the given cluster. |
dbCountRecords() | Counts records on a database. |
dbReload() | Reloads the database on the client interface. |
dbSize() | Returns the size of the database. |
getTransactionStatement() | Instantiates a transaction interface. |
query() | Queries the database. |
queryAsync() | Queries the database with support for callback functions and Fetching Strategies. |
recordCreate() | Creates a record on database. |
recordLoad() | Loads a record from the database. |
recordUpdate() | Updates a record on the database. |
sqlBatch() | Executes an SQL batch command. |