-
Notifications
You must be signed in to change notification settings - Fork 2
Home
OrionDB is a generic DB front end in PHP for use with the SC.RestServer server communication object in Sproutcore.
It provides a transparent PHP layer to your model system in a database for your Sproutcore application.
You can read more about the exact responses of OrionDB in How OrionDB handles requests.
Work on OrionDB has been delayed quite a bit due to other work. As there is a new opportunity for using it, a few changes are made to ease the use of the database wrapper system outside the REST-interface. I am still planning to get back to hooking it up to Sproutcore, but due to other priorities development in this direction will be delayed. ( :-( )
OrionDB is undergoing some small changes to work with Sproutcore 1.0.
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.
If you want to write your own plugin, please feel free to do so. There is no documentation about it yet, but if you create an object having the same functions as are in the OrionDB_MySQL.php file, and adjust the OrionDB_postconfig.php to include your setting and file, things should work fine.
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 MIT license.
- 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
- permission system
- 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 tohttp://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 think you have found a bug in the system, please file a ticket at http://mauritslamers.lighthouseapp.com/projects/19148/home and if you can, provide a patch or code that fixes the problem.
- If you encounter issues, please go to the Sproutcore IRC channel on freenode: #sproutcore and ask for help there.