![]() ![]() if not, create it with "CREATE" queriesģ. In case of such a design, you can then use this strategy:Ģ. The key in such a sync is using UUIDs for IDs in your record instead of numbers. When it becomes online, you can sync the data between them using a B4J/BANano REST API (fetch new data from the server, update the server with data entered/changed/deleted when offline). One can then write a sync between them if the app is online: so offline as a PWA it uses the alaSQL database. With BANanoServer (which is a wrapped jServer) it is then a 100% B4X solution and you never have to leave the B4X environment (in fact, it is all done in one IDE). I personally prefer to have an alaSQL on the browser side and a jServer+MySQL on the back-end side. ![]() Execute a number of "INSERT" queries to append the data if not, create it with "CREATE" queries (you can dump these queries from the sqlite database, and make the changes so they are alaSQL compatible)Ĥ. check if the database exists on the Browsers sideĢ. execute the attach command to convert the sqlite DB to an indexeddb, e.g.Īnother way would be, as this is a one-time-thing to prepare the data anyways, to just export the data from sqlite to csv: ġ. check if the database exists on the Browser sideģ. I read people have mixed results with this so you will need to investigate it more.ġ. I see there is some kind of sqlite 2 indexeddb already available in alaSQL: The programmer can then write this himself how he sees fit. I don't think this should be part of the BANano core engine as I like to keep it as abstract from any app logic as possible. We will explore how we can create an in-memory db and then backup an existing BANanoSQL db to it and then download the content. We will select and view all records from the users table. We will add some records to the users table.Ĥ. We will create a table called users with auto increment fields.ģ. ![]() Ensure the database is loaded under your Files tab.Ģ. Android comes with an inbuilt implementation of a database package, which is SQLite, an open-source SQL database that stores data in form of text in devices. We might even be able to use this to backup a BANanoSQL database.ġ. Whatever changes we make to it will not be persisted, unless of course we download the file. In this exercise, we open an existing database. We are logging everything the demo does to console.log. This does not depend on PHP but just two js libs, sql.js and filesave.js. Here we explore part 2 of the tutorial, however now made into a library. These databases are mainly for read only access purposes where one just wants to display data. Never construct SQL statements on the fly.At some stage we explored how one can distribute / embed SQLite database on their BANano app. Use of the ? placeholder feature of the method to avoid against SQL injection attacks, and to ![]() Takes two parameters: the transaction itself, and the error object.Įnqueue a SQL statement to execute in the transaction. Two parameters: the transaction itself, and a ResultSet object (see below) with the resultsĬalled if an error occurred executing this particular query in the May contain ? placeholders, with values to be substituted listed in the arguments parameter.Īn array of values (numbers, strings or nulls) to substitute for ? placeholders in theĬalled when the query is successfully completed during the transaction. Use the following function (or similar) to open your database: import * as FileSystem from 'expo-file-system' import * as SQLite from 'expo-sqlite' import, readOnly ) Executing statements outside of a transactionĪ string containing a database query to execute expressed as SQL. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |