1

I am integrating SQLite in my ionic application. While executing the code getting following error.

ERROR Error: Uncaught (in promise): Error: a statement with no error handler failed: sqlite3_prepare_v2 failure: incomplete input Error: a statement with no error handler failed: sqlite3_prepare_v2 failure: incomplete input

my code as below.

createEncryptedDB() {
    this.platform.ready().then(() => {
      this.sqlite.create({
        name: 'sampleDb',
        location: 'default',
        key: 'mypassword'
      }).then((sqlObject: SQLiteObject) => {
        this.db = sqlObject;
        const tableList: any = [];
        tableList.push(['CREATE TABLE IF NOT EXISTS TEST_DATA(kty text, kty_type varchar(30)']);
        this.queryAll(tableList).then(() => { 
           console.log("Tables were created")
         }).catch((ex) => {
            return Promise.reject(ex);
          });
        });
    });
  }

  public queryAll(list: any[]): Promise<any> {
    return new Promise((resolve, reject) => {
      try {
        this.platform.ready().then(() => {
          resolve();
          return this.db.sqlBatch(list);         
        });
      } catch (err) {
        reject({ err: err });
      }
    });

Please note that we are encrypting the database. Can anybody know how to fix this?

1 Answer 1

1

There is a syntax error in the CREATE TABLE command. It is missing a final closing ). That may not be the only error in the code, but it explains this specific failure.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.