Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

Database

eyeyunianto edited this page Nov 10, 2013 · 4 revisions

Handling Database

Some database can be used on IGN SDK. Some example of application of database on example project

  • .sql() used to call sql API. Example ign.sql()
  • .driver("name_of_database","server_location:user_database:password:database_password") used to connect with database. Example sql.driver (“mysql”, “localhost: root: password: ignsdk”)
  • .query ("query_that_be_run") used to run database query. Example ign.query ("select * from participants")
  • console.log(query.status) used to check query of database. The output will be true or false. Example console.log ($. parseJSON (sql.query (“select * from participants”)).status) or query can be split from API.
  • console.log (query.content); used to show record data. Example console.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
Clone this wiki locally