The undefined error when working with SQLite database

43 views
Skip to first unread message

DogPlanner GSS

unread,
Mar 2, 2026, 6:51:05 AM (2 days ago) Mar 2
to DroidScript
Dear Developers,

Thank you very much for all previous answers - we use these in our new developed app.

Now we have the following question concerning DroidScript working with SQLite database.

When we try to perform the following functions -> undefinded error appears and there aren't any columns and table in the "MyPets" file.

function dbStartingInitialization() {
   
    // Create or open database MyPets
    db = app.OpenDatabase("MyPets");
   
    // Create a table (if it doesn't exist already)
    db.ExecuteSql( "CREATE TABLE IF NOT EXIST pets (id integer primary key, name text, catordog text, breed integer, birthday text, weight integer, gender integer, common text)" );

    // E.g. insert first pet
    db.ExecuteSql( "INSERT INTO pets(name, catordog, breed, birthday, weight, gender, common) VALUES (?,?,?,?,?,?,?)", ["Dory", "Dog", 0, "15.09.2015", 10, 1, "Best dog"], OnSuccess, OnError );

}

// Callback for successsful SQL execution
function OnSuccess( results ) {
 
    app.ShowPopup("SQL-demand is Ok");  
}

// Callback for errors when SQL execution
function OnError( error) {
   
    app.ShowPopup("Error: " + error.message );  
}

May be we made something wrong. Could you see and tell us pls your assumptions?

Thank you very much in advance.

Have a nice day.

Best regards
Dmitry

Jumar

unread,
Mar 2, 2026, 9:15:31 AM (2 days ago) Mar 2
to DroidScript
"EXIST" must be "EXISTS"

DogPlanner GSS

unread,
Mar 2, 2026, 10:10:51 AM (2 days ago) Mar 2
to DroidScript
Dear Jumar,

thank you very much! 

Thats what can happens because of one letter! The compiler doesn't give an error thats why i thought may be this is the problem.

Thank you again and sorry for bother you.

Best regards
Dmitry

понедельник, 2 марта 2026 г. в 17:15:31 UTC+3, Jumar:

Alan Hendry

unread,
Mar 2, 2026, 11:07:05 AM (2 days ago) Mar 2
to DroidScript
HI,
For future reference
If you touch the "bug" icon at the bottom of the edit screen
(instead if the run triangle)
 it showed an error in the SQL CREATE
Regards, ah

DogPlanner GSS

unread,
Mar 2, 2026, 12:47:21 PM (2 days ago) Mar 2
to DroidScript
Dear Alan,

thank you very much for information! We will to know this from now on.

Have a nice day.

Best regards
Dmitry

понедельник, 2 марта 2026 г. в 19:07:05 UTC+3, hendr...@gmail.com:
Reply all
Reply to author
Forward
0 new messages