OP-Engineering / op-sqlite

Fastest SQLite library for react-native by @ospfranco
MIT License
598 stars 41 forks source link

Weird bug on 8.0.1 version for empty spaces in query #149

Closed On2it-Clifford closed 2 months ago

On2it-Clifford commented 2 months ago

Describe the bug

(async() => {
    let db = open({ name: 'test' });
    await db.execute('SELECT 1 '); // No issue
    await db.execute('SELECT 1       '); // No issue
    await db.execute('SELECT 1; ', []); // Will show warning [op-sqlite] SQL execution error: not an error
    await db.execute('SELECT ?; ', [1]); // Will crash the entire app immediately
})();

Test cases: 1) No issue will happen with single space without semicolon 2) No issue will happen with multiple spaces without semicolon 3) Will show warning when parameter is not used with semicolon + spaces behind semicolon 4) Will immediately crash app when parameter is used with semicolon + spaces behind semicolon

**I understand the spaces should not appear, but previous version is not that lenient and will not crash the app when some mistake like this is made.

Versions:

ospfranco commented 2 months ago

Thanks for testing, had to do with executing more than one statement per string. Fix is released in 8.0.3