function db_errorCB(transaction, e) {
console.log(e);
console.log("e.message :" + e.message);
}
참고 :
http://stackoverflow.com/questions/16559832/how-to-get-the-context-of-a-web-sql-error
2014/06/18
2014/06/16
Web SQL search on dates
select * from dates
where dte = date('now')
;
select dtm from datetimes
where dtm >= datetime(date('now'))
and dtm < datetime(date('now', '+1 day'))
;
select datetime(dtm, 'unixepoch', 'localtime') from unix
where dtm >= strftime('%s', date('now'))
and dtm < strftime('%s', date('now', '+1 day'))
;
https://gist.github.com/dwurf/8929425
where dte = date('now')
;
select dtm from datetimes
where dtm >= datetime(date('now'))
and dtm < datetime(date('now', '+1 day'))
;
select datetime(dtm, 'unixepoch', 'localtime') from unix
where dtm >= strftime('%s', date('now'))
and dtm < strftime('%s', date('now', '+1 day'))
;
https://gist.github.com/dwurf/8929425
Web SQL error handling
db.transaction(function(tx) {
tx.executeSql(query, values, successHandler, errorHandler);
});
function errorHandler(tx, e) {
console.log(e);
console.log("e.message :" + e.message);
Web SQL get last row
SELECT * FROM table ORDER BY column DESC LIMIT 1;
http://stackoverflow.com/questions/9902394/how-to-get-last-record-from-sqlite
http://stackoverflow.com/questions/9902394/how-to-get-last-record-from-sqlite
2014/06/12
Web SQL INSERT OR ...
"INSERT OR IGNORE" (="INSERT ON CONFLICT IGNORE")
> 초기값 셋팅에 활용
"INSERT OR UPDATE"
> 중복시 값 변경에 활용
http://www.sqlite.org/lang_conflict.html
> 초기값 셋팅에 활용
"INSERT OR UPDATE"
> 중복시 값 변경에 활용
http://www.sqlite.org/lang_conflict.html
Web SQL 여러줄 삽입
insert multiple rows at a time in an SQLite database
MySQL example:
INSERT INTO 'tablename' ('column1', 'column2') VALUES
('data1', 'data2'),
('data3', 'data4'),
('data5', 'data6'),
('data7', 'data8');
This can be recast into SQLite as:
INSERT INTO 'tablename'
SELECT 'data1' AS 'column1', 'data2' AS 'column2'
UNION SELECT 'data3', 'data4'
UNION SELECT 'data5', 'data6'
UNION SELECT 'data7', 'data8'
http://stackoverflow.com/questions/1609637/is-it-possible-to-insert-multiple-rows-at-a-time-in-an-sqlite-database
MySQL example:
INSERT INTO 'tablename' ('column1', 'column2') VALUES
('data1', 'data2'),
('data3', 'data4'),
('data5', 'data6'),
('data7', 'data8');
This can be recast into SQLite as:
INSERT INTO 'tablename'
SELECT 'data1' AS 'column1', 'data2' AS 'column2'
UNION SELECT 'data3', 'data4'
UNION SELECT 'data5', 'data6'
UNION SELECT 'data7', 'data8'
http://stackoverflow.com/questions/1609637/is-it-possible-to-insert-multiple-rows-at-a-time-in-an-sqlite-database
피드 구독하기:
글 (Atom)