andpor / react-native-sqlite-storage

Full featured SQLite3 Native Plugin for React Native (Android and iOS)
MIT License
2.75k stars 521 forks source link

Cannot select data from database #455

Closed Javiercuba closed 2 years ago

Javiercuba commented 3 years ago
## Expected Behavior Create table "table_task", insert the data and then select * from this table ## Current Behavior The table is created and the data is being inserted, however, on the select statement, the result is undefined. ## Steps to Reproduce (for bugs) ```ts import { openDatabase, SQLiteDatabase } from "react-native-sqlite-storage"; export const getDB = async (): Promise => { const db = await openDatabase({ name: "Sysbov.db", location: "default" }); db.executeSql( "CREATE TABLE IF NOT EXISTS table_task (id INTEGER PRIMARY KEY AUTOINCREMENT,data text,about text,task text);" //Criar tabela para animais ); db.executeSql( 'INSERT INTO table_task (data,about,task) values("aaa","cinco","seis")', [], () => console.log("inseriu"), (_tx, e) => console.log(e) ); db.executeSql( "SELECT * FROM table_task", [], (_, la) => { console.log(la); }, (_tx, e) => console.log(e) ); return db; }; ``` ## Context I'm trying to do a basic CRUD. ## Your Environment
  • React Native SQLite Storage Version used: 5.0.0
  • React Native version used: 0.63.3
  • Operating System and version (simulator or device): Ubuntu
  • IDE used: VsCode
andpor commented 2 years ago

not enough information to reproduce.