objDB‎ > ‎

ObjDB Reference

If you really want to know all the details, have a look at the source code.

Methods - All databases

open(string dbString, string user, string pass)

Open database or spreadsheet

Arguments:

Name Type Description
dbString string jdbc connection string or unique identifier for spreadsheet
user string (jdbc only)
pass string (jdbc only)

Return Values:

Type Description
object handler for further operations

deleteRow(object handler, string table, object cond)

Delete a row from the database

Arguments:

Name Type Description
handler object
table string table in which row is set
cond object key/value pair to identify row(s) to be deleted

Return Values:

Type Description
int nr. of rows affected?

insertRow(object handler, string table, object values)

Insert a row in the database

Arguments:

Name Type Description
handler object
table string table in which row is set
values object key/value pairs in row that will be inserted

Return Values:

Type Description
int nr. of rows affected

updateRow(object handler, string table, object values, object cond)

Update a row in the database

Arguments:

Name Type Description
handler object
table string table in which row is set
values object key/value pairs that will be set in row
cond object key/value pair to identify row(s) to be updated

Return Values:

Type Description
int nr. of rows affected?

replaceRow(object handler, string table, object values, object cond)

Replace a row in the database--insert if the row does not exist yet

Arguments:

Name Type Description
handler object
table string table in which row is set
values object key/value pairs that will be set in row
cond object key/value pair to identify row(s) to be updated

Return Values:

Type Description
int nr. of rows affected?

getRows(object handler, string table, array columns, object cond, int limit)

Get result rows: columns from table where cond

Arguments:

Name Type Description
handler object
table string database table
columns array list of columns, use all columns if no array or empty array
cond object key/value pairs for selecting rows
limit int max number of rows returned

Return Values:

Type Description
array array of objects, objects have column labels as keys

Methods - Spreadsheets only

setSkipRows(object handler, string table, int index, int howMany)

Set the rows to skip in sheets (spreadsheets only) so first row contains headers and second and below data similar to JS array splice function

Arguments:

Name Type Description
handler object
table string name of sheet
index int  number of first row to skip, as in right margin in spreadsheet view
howMany int number of rows to remove

Methods - JDBC only

query(object handler, string query)

Do a simple query without getting results, (jdbc only) useful for modifying, creating and deleting tables

Arguments:

Name Type Description
handler object
query string simple query to be executed

Return Values:

Type Description
boolean indicating success or failure.

insertId(object handler)

Get key of last insert statement (jdbc only)

Arguments:

Name Type Description
handler object

Return Values:

Type Description
int

close(object handler)

Close the database connection (jdbc only)

Arguments:

Name Type Description
handler object

update(object handler, string query)

Do an update query without getting results, (jdbc only) use for INSERT, DELETE, UPDATE

Arguments:

Name Type Description
handler object
query string simple query to be executed

Return Values:

Type Description
int nr. of rows affected?

getRowsByQuery(object handler, string query)

Get result rows from a SELECT query (jdbc only)

Arguments:

Name Type Description
handler object
query string SELECT query to be executed

Return Values:

Type Description
array array of objects, objects have column labels as keys


Comments