Name | Description |
SK.DB( token ) | Constructor |
Database methods | |
getDatabases( | Gets the list of current databases. The callback_ok's interface is: |
getDatabase( | Retrieves information about a given db_id. The callback_ok receives a hash of the database meta data (see db.get) |
getDatabaseID( | Retrieves the ID of a database by its name. |
addDatabase( | Adds a database to the account which supplies the current token. The callback_ok receives a hash with the database meta (see db.add). |
Column methods | |
getColumns( | Returns the list of columns for a given database ID. |
getColumnsMeta( | Returns the pure column meta information (without the Database Editor related one) as db.column.get provides, but for a list of columns. |
addColumn( | Adds a column to a database mentioned in the hash column_meta. For more information about the keys in column_meta see the db.column.add API call. |
updateColumn | Not implemented yet. |
removeColumn | Not implemented yet. |
Cells operations | |
updateCells | Not implemented yet. |
Records operations | |
getRecords( | Retrieves all records from a given database filtered by "filter". The result contains only the columns listed in column_names. If the column_names array is set to null, all columns exist in the result. |
getRecordsByIDs( | This is the same function as getRecords, but the difference is in the list of columns. Here you specify an array of columns_meta — the same array getColumns or getColumnsMeta returns. The rest of the definition of getRecords applies here too. |
addRecord( | Adds a new record to the database. |
addRecordByIDs( | The method does the same as addRecord, but the parameters differ a little. There is an extra array of columns_meta (the same getColumns returns) and the "cells" are not a hash by column name, but by column ID, i.e.: |
updateRecord( | Updates the cells of a given record in the database. |
updateRecordByIDs( | The same as updateRecord — updates a record in a database. The parameters differ a little. The columns_meta is what getColumns returns to callback_ok. The "cells" are not a hash by column name, but by column ID: |
removeRecord | Not implemented yet. |
Access tokens methods | |
getTokens( | This method (as well as the other token-related methods) makes sense only if the token passed in the constructor is the logged user session ID. Otherwise it will result into an "Access denied" |
addToken( | Adds a token to the current account. The "properties" of the token are a hash with the same key-value options as db.access.add requires. |
updateToken( | Updates an existing access token. You can't update the token key though, but you can update its name and extra information. |
getTokenByName( | As the name implies, this method retrieves the token information by finding a token with a given "name". |
getToken( | Returns the token meta information but by specifying a token ID. The "callback_ok" has the same interface as in getTokenByName. |
Examples
Getting a filtered list of rows from a database "Users" where there is a "Name" column. This example will display a neat way to build your code in an object oriented manner.
<script type="text/javascript"> |