Home
ObjDB
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? |
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. |
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 |
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? |
close(object handler)
Close the database connection (jdbc only)
Arguments:
Name | Type | Description |
---|---|---|
handler | object |
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? |
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 |
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? |
insertId(object handler)
Get key of last insert statement (jdbc only)
Arguments:
Name | Type | Description |
---|---|---|
handler | object |
Return Values:
Type | Description |
---|---|
int |
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 |
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? |
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 |