Detailed reference of prototypes, properties and methods available in the
Javascript environment of your Helma web applications.

Properties and methods of the helma.Database prototype.
To use this optional module, its repository needs to be added to the application, for example by calling app.addRepository('modules/helma/Database.js')
helma Database(source)
Constructor for Database objects, providing access through relational databases through JDBC. It is usually simpler to use one of the factory methods {@link #createInstance} or {@link #getInstance}.
parameters

DbSource | source | instance of a helma.objectmodel.db.DbSource

methods

- getConnection()

- getProductName()

- isOracle()

- isMySql()

- isPostgreSql()

- query(sql)

- execute(sql)

- getName()

- getDriverName()

Methods
helma.Database. getConnection()
Get the java.sql.Connection for this Database instance. This can be used to operate on the connection directly, without going through the helma.Database class.
returns

java.sql.Connection | the JDBC connection

helma.Database. getProductName()
Returns the lower case name of the underlying database product.
returns

String | the name of the DB product

helma.Database. isOracle()
Returns true if this is an Oracle database.
returns

boolean | true if this is an Oracle database.

helma.Database. isMySql()
Returns true if this is a MySQL database.
returns

boolean | true if this is an MySQL database.

helma.Database. isPostgreSql()
Returns true if this is a PostgreSQL database.
returns

boolean | true if this is a PostgreSQL database.

helma.Database. query(sql)
Executes the given SQL statement. The result set is returned as JavaScript Array containing a JavaScript Object for each result.
parameters

String | sql | an SQL query statement

returns

Array | an Array containing the result set

helma.Database. execute(sql)
Executes the given SQL statement, which may be an INSERT, UPDATE, or DELETE statement or an SQL statement that returns nothing, such as an SQL data definition statement. The return value is an integer that indicates the number of rows that were affected by the statement.
parameters

String | sql | an SQL statement

returns

int | either the row count for INSERT, UPDATE or DELETE statements, or 0 for SQL statements that return nothing

helma.Database. getName()
Return the name of the Helma DbSource object.
returns

String | the DbSource name

helma.Database. getDriverName()
Return the name of the JDBC driver used by this Database instance.
returns

String | the JDBC driver name

helma. Database.createInstance(driver, url, name, user, password)
Create a new Database instance using the given parameters.

Some of the parameters support shortcuts for known database products. The `url` parameter recognizes the values "mysql", "oracle" and "postgresql". For those databases, it is also possible to pass just `hostname` or `hostname:port` as `url` parameters instead of the full JDBC URL.

parameters

String | driver | the class name of the JDBC driver. As shortcuts, the values "mysql", "oracle" and "postgresql" are recognized.
String | url | the JDBC URL.
String | name | the name of the database to use
String | user | the the username
String | password | the password

returns

helma.Database | a helma.Database instance

helma. Database.getInstance(name)
Get a Database instance using the Database source defined in the application's db.properties file with the given name.
parameters

String | name | the name of the DB source as defined in db.properties

returns

helma.Database | a helma.Database instance

Tue, 25 Nov 2008 16:50:09 GMT.

### core framework

- global
- app (application)
- req (request)
- res (response)
- session
- path
- root
- HopObject
- User
- File
- FtpClient
- Image
- Mail
- Remote
- Xml
- DatabaseObject
- MimePart
- Skin
- Object

### optional modules

- Array extensions
- Date extensions
- Number extensions
- Object extensions
- String extensions
- HopObject extensions
- global macros
- macro filters
- JSON methods
- helma.Aspects
- helma.Chart
- helma.Color
- helma.Database
- helma.File
- helma.Ftp
- helma.Group
- helma.Html
- helma.Http
- helma.Image
- helma.Mail
- helma.Search
- helma.Skin
- helma.Ssh
- helma.Url
- helma.Zip
- jala.BitTorrent
- jala.Captcha
- jala.Date
- jala.db
- jala.DnsClient
- jala.Form
- jala.History
- jala HopObject extensions
- jala.HtmlDocument
- jala.I18n
- jala.ImageFilter
- jala.IndexManager
- jala.ListRenderer
- jala.Mp3
- jala.PodcastWriter
- jala.RemoteContent
- jala.Rss20Writer
- jala.Utilities
- jala.XmlRpcRequest
- jala.XmlWriter

### java libraries

- browse docjar