MDb Framework 에 대한 필수 API 를 정의
로컬 데이터 베이스 기능에 대한 API 를 제공
Changed in version 2.1.0
Arguments
Arguments
Example:
M.db.create({
path:'db_name',
callback: function(status, path){
console.log(status, path);
}
});
Changed in version 2.1.0
Arguments
Example:
M.db.create('db_name', function(status, name){
console.log(status, name);
});
Changed in version 2.1.0
Arguments
Arguments
Example:
M.db.close({
path:'db_name',
callback: function(status, path){
console.log(status, path);
}
});
Changed in version 2.1.0
Arguments
Example:
M.db.close('db_name', function(status, name){
console.log(status, name);
});
Changed in version 2.1.0
Arguments
Arguments
Example:
M.db.open({
path:'db_name',
callback: function(status, path){
console.log(status, path);
}
});
Changed in version 2.1.0
Arguments
Example:
M.db.open('db_name', function(status, name){
console.log(status, name);
});
Changed in version 2.1.0
Arguments
Arguments
Example:
M.db.remove({
path:'db_name',
callback: function(status, path){
console.log(status, path);
}
});
Changed in version 2.1.0
Arguments
Example:
M.db.remove('db_name', function(status, name){
console.log(status, name);
});
Changed in version 2.1.0
Arguments
Arguments
Example:
var query = 'SELECT * FROM books';
M.db.execute({
path:'db_name',
sql: query,
callback: function(status, result, name){
console.log(status, path);
}
});
var query = 'INSERT INTO books (title, author) values ("제목1", "작가1");INSERT INTO books (title, author) values ("제목2", "작가2")';
M.db.execute({
path:'db_name',
sql: query,
multiple: true,
callback: function(status, result, name){
console.log(status, path);
}
});
Changed in version 2.1.0
Arguments
Example:
var query = 'CREATE TABLE books (id INTEGER PRIMARY KEY, title varchar(255) not null, author varchar(255) not null )'
M.db.execute('db_name', query, function(status, result, name){
M.tool.log(status, result, name);
alert( status + ", " + JSON.stringify(result) + ", " + name );
});
var query = 'INSERT INTO books (title, author) values ("제목1", "작가1")';
M.db.execute('db_name', query, function(status, result, name){
M.tool.log(status, result, name);
alert( status + ", " + JSON.stringify(result) + ", " + name );
});
var query = 'SELECT * FROM books';
M.db.execute('db_name', query, function(status, result, name){
console.log(status, result, name);
});