andpor / react-native-sqlite-storage

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

Sql query shows only row amount not row data #453

Closed binhchili closed 3 years ago

binhchili commented 4 years ago

Expected Behavior

When I log the result in executeSql method I should receive data of all rows

Current Behavior

Instead it log this :item: {"rows":{"length":70},"rowsAffected":0}

Steps to Reproduce (for bugs)

Here is my code :

let db;
...
useEffect(()=>{
 db = SQLite.openDatabase({
            name: 'highschool.db',
            createFromLocation: '~highschool.db',
        }, okCallback, errorCallback);
        db.transaction((trans => {
            trans.executeSql('select distinct field2 from highschool', [], (trans, result) => {
                console.log('item: ' + JSON.stringify(result));
            })
        }));
...
},[])
...

Your Environment

codigocarvalho commented 3 years ago

Try result.rows.raw() without JSON.stringify

andpor commented 3 years ago

@binhchili - has @henrineken hint help resolve your concern? If so please close this issue...