Constructor
new RamDatabase(name, username, password)
Returns a newly created RamDatabase instance.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | The name of the database. If not given a private un-named database is created, that can only be accessed through this instance of jala.db.RamDatabase |
username |
String | Optional username (defaults to "sa"). This username is used when creating the database, so the same should be used when creating subsequent instances of jala.db.RamDatabase pointing to a named database. |
password |
String | Optional password (defaults to ""). |
- Source:
Returns:
A newly created instance of RamDatabase
Methods
copyTables(database, tables)
Copies all tables in the database passed as argument into this embedded database.
If any of the tables already exists in this database, they will be removed before
re-created. Please mind that this method ignores any indexes in the source database,
but respects the primary key settings.
Parameters:
Name | Type | Description |
---|---|---|
database |
helma.Database | The database to copy the tables from |
tables |
Array | An optional array containing the names of the tables to copy. If not given all tables are copied |
- Source:
dropTable(tableName)
Drops the table with the given name
Parameters:
Name | Type | Description |
---|---|---|
tableName |
String | The name of the table |
- Source:
Returns:
True if the table was successfully dropped, false otherwise
dump(file, props)
Dumps the database schema and data into a file
Parameters:
Name | Type | Description |
---|---|---|
file |
helma.File | The file where the database dump will be |
props |
Object | Optional object containing connection properties |
- Source:
Returns:
True in case the database was successfully dumped, false otherwise
getConnection(An)
Returns a connection to this database
Parameters:
Name | Type | Description |
---|---|---|
An |
Object | optional parameter object containing connection properties to add to the connection Url. |
- Source:
Returns:
A connection to this database
getName()
Returns the name of the database
- Source:
Returns:
The name of the database
getPassword()
Returns the password of this database
- Source:
Returns:
The password of this database
getProperties(props)
Returns a properties object containing the connection properties
for this database.
Parameters:
Name | Type | Description |
---|---|---|
props |
Object | An optional parameter object containing connection properties to add to the connection Url. |
- Source:
Returns:
A properties object containing the connection properties
getUrl(props)
Returns the JDBC Url to connect to this database
Parameters:
Name | Type | Description |
---|---|---|
props |
Object | Optional connection properties to add |
- Source:
Returns:
The JDBC url to use for connecting to this database
getUsername()
Returns the username of this database
- Source:
Returns:
The username of this database
runScript(file, props, charset, continueOnError)
Runs the script file passed as argument in the context of this database.
Use this method to eg. create and/or populate a database.
Parameters:
Name | Type | Description |
---|---|---|
file |
helma.File | The script file to run |
props |
Object | Optional object containing connection properties |
charset |
String | Optional character set to use (defaults to "UTF-8") |
continueOnError |
Boolean | Optional flag indicating whether to continue on error or not (defaults to false) |
- Source:
Returns:
True in case the script was executed successfully, false otherwise
shutdown()
Stops this in-process database by issueing a "SHUTDOWN" sql command.
- Source:
tableExists(name)
Returns true if the table exists already in the database
Parameters:
Name | Type | Description |
---|---|---|
name |
String | The name of the table |
- Source:
Returns:
True if the table exists, false otherwise