This repository has been archived by the owner on Sep 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Database
Surya Handika Putratama edited this page Apr 20, 2014
·
4 revisions
Some database can be used on IGN SDK. Some example of application of database on example project
Must be declarated when use function. So we can make some variable like below:
var db = ign.sql();
-
db.driver("name_of_dbms","server_location:dbms_user:dbms_password:database_name")
used to connect with database. Examplesql.driver (“mysql”, “localhost:root:password:ignsdk”)
-
db.query ("query_that_be_run")
used to run database query. Exampleign.query ("select * from participants")
-
console.log(query.status)
used to check query of database. The output will be true or false. Exampleconsole.log ($.parseJSON(sql.query(“select * from participants”)).status)
or query can be split from API. -
console.log (query.content);
used to show record data. Exampleconsole.log ($.parseJSON(sql.query (“select * from participants”)).content)
or query can be split from API.
Note Database API Specific
- set driver :
db.driver("sql_driver ex:sqlite2/sqlite3/mysql","connection")
- connection :
mysql = "hostname:user:password:database";
sqlite2 or sqlite3 = "database file";
Example application that used Database API
/ / call IGNSDK sql API
var sql = ign.sql();
/ / connect to database
var driver = sql.driver (“mysql”, “localhost: root: password: ignsdk”);
/ / query
var query = $. parseJSON (sql.query (“select * from participants”));
/ / check connection status
console.log (query.status); / / false or true
/ / get data record
console.log (query.content);
- Complete Project can be found on Database