Skip to content
mauritslamers edited this page Sep 13, 2010 · 29 revisions

Welcome to the OrionDB wiki!

OrionDB is a generic DB front end in PHP for use with the SC.RestServer server communication object in Sproutcore.
It allows you to create a model system in a database and use the same model system in Sproutcore and get direct access to it.

The latest updates

Database backend
Originally, OrionDB only supported MySQL as a database backend. The base classes have been rewritten to be more or less database agnostic, as long as an SQL-based database backend is being used.
The database queries have been moved to a MySQL plugin. A PostgreSQL plugin is under development.

Case sensitivity
Because of MySQL, the names of the database tables had to be in the same case as the model names. Because this is not standard and not supported by for example PostgreSQL, the comparison to the table names has been made case-insensitive.

A few notices:

  • OrionDB doesn’t have a permission system yet.

OrionDB is released under the very liberal MIT license.

Features

  • Generic access to the database using the table names as models. Just create the database and your SC models.
  • You can configure OrionDB to only allow connections from Sproutcore applications.
  • Sessions and support for a SC login client with automatic forwarding

Future Features

  • permission system

If you do not get it working

  • Check whether the server in your application or framework has the postFormat property set to SC.JSON_FORMAT. This is set in the core.js of your application or framework and the line should look like this:

  server: SC.RestServer.create({ prefix: ['appName'], postFormat: SC.JSON_FORMAT }),

where appName is the name of your application or framework

  • Check whether the names in the request match the names of the tables exactly. OrionDB expects the names of your models to be the same in both MySQL and Sproutcore (case-insensitive). This is because OrionDB will search for the table with the same name as is requested and generate the necessary information directly from the table data in the database. So check whether the name in the resourceURL, the model name and the table name in MySQL are the same.
    So, a resourceURL 'tablename' in your Sproutcore model will result in a request to http://host/path/to/resource/tablename' and this will return the contents of that table in a JSON encoded string containing a property called type with the name of the table in it.
  • OrionDB expects the .htaccess file to forward the actual request to index.php. If the Apache configuration does not allow the use of .htaccess files to extend the server configuration, contact your system administrator to have that setting adjusted.
  • If you encounter issues, please go to the Sproutcore IRC channel on freenode: #sproutcore and ask for help there.

Comments

Clone this wiki locally