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
eyeyunianto edited this page Nov 10, 2013
·
4 revisions
Some database can be used on IGN SDK. Some example of application of database on example project
-
.sql()
used to call sql API. Exampleign.sql()
-
.driver("name_of_database","server_location:user_database:password:database_password")
used to connect with database. Examplesql.driver (“mysql”, “localhost: root: password: ignsdk”)
-
.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 :
sql.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