dog*_*tar 6 sqlite react-native
Hi is there any way to do a bulk insert in the SQLite in React-native?
I am using the following library
https://github.com/andpor/react-native-sqlite-storage
I have tried the following code but it just inserts all the values to the first column in the table.
export function saveWelfareInfo(authenticationToken, welfareArr) {
var sqlQuery = 'authenticationToken, enabled, title, tabname, tabimage, tabcontents, last_update_date, id, ethnicity_id, course, campus, app_profile_id'
let db = OpenSqliteDatabase()
db.transaction((tx) => {
tx.executeSql('insert into welfare_list(' + sqlQuery + ') values(?,?,?,?,?,?,?,?,?,?,?,?)', welfareArr)
tx.executeSql('SELECT * FROM welfare_list', [], (tx, results) => {
console.log("Query completed");
var len = results.rows.length;
for (let i = 0; i < len; i++) {
let row = results.rows.item(i);
console.log('welfare_list Record: ', row);
}
});
})
Run Code Online (Sandbox Code Playgroud)
Any help would be greatly appreciated. thanks in advance
| 归档时间: |
|
| 查看次数: |
8726 次 |
| 最近记录: |