Hi, need help with Sqlite

Please provide the following:

  1. SDK Version: ^36.0.2
  2. Android

Hi i am creating a simple note taking app with typescript and i need to use sqlite for storing but the api is somewhat confusing for me. Please help me understand this things:

  1. What are the return types of:

Transaction callback,
Transaction error callback,
Transaction succes callback,
ExecuteSql success callback,
ExecuteSql error callback

  1. What are the parameters and and the types of the parameters in:

Transaction error callback,
Transaction succes callback,
ExecuteSql success callback,
ExecuteSql error callback

  1. What are the differences between:

Transaction error callback and executeSql error callback
Transaction succes callback and executeSql success callback

// Transaction
db.transaction(

    // Transaction callback
    (transaction: SQLTransaction) => {
        transaction.executeSql(
        
            // Sqlite statement
            "Sqlite statement",
            
            // Arguments
            [],

            // ExecuteSql success callback 
            () => {},

            // ExecuteSql error callback
            () => {}
        );
    }, 

    // Transaction error callback
    () => {},

    // Transaction succes callback
    () => {}
);

Hi! Since Expo’s open source, you can see all the type information in the SQLite .types file!

As for your third question, the executeSql callbacks are called when the query completes or errors, while the transaction callbacks are called when the transaction itself completes/errors

1 Like

Hi, what does the return value of the ExecuteSql error callback mean and what does it do ? I am kinda new to Databases

Not sure what you mean- you configure what the error callback will do/return. It’s provided for you to handle the case where a particular query errors

According to SQLite types file: the SQLStatementErrorCallback return value/type is a boolean. What does the boolean return value/type mean or do.

export interface SQLStatementErrorCallback {
  (transaction: SQLTransaction, error: SQLError): boolean;
}

I hope you can understand what i mean now

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.