更新資料
1. 更新特定記錄
我們正在更新 名為Student_Table的資料表,我們想把所有s_name= 'Mary Jesscia' 的s_no由3轉為4
方便起見,你可先運行下面的代碼建立資料表和記錄。
JPocket.add('Student_Table', ['s_no', 's_name']);
JPocket.insert('Student_Table', { s_no: '3', s_name: 'Mary Jesscia' });
var result = JPocket.update('Student_Table',
function load(result) {
if (result.s_name === 'Mary Jesscia') {
//Return the object "result" if condition matches ,
//Otherwise return false
result.s_no = 4;
return result;
} else {
return false;
}
});
Syntax
Parameter Type:
JPocket.update( String , function load(result) { });
Return Value:
N/A
Updated less than a minute ago