Ola
Some time ago, I wrote a piece here on... [BANano]: BANanoSQL CRUD-ing around with BANanoSQLUtils.
That approach followed, SQLExecuteResult methodology of doing things, where there was a single method to rule them all, i.e. all the database functions are managed by one function. From version 2.15+ of BANano, there was a callback functionality that was added to BANanoSQL due a request I made. What a Marvel!
I've been exploring the logic behind this methodology and its quite impressive and rather simple. The ExecuteCallBack BANanoSQL functionality should be thought of as some kind of pairing functionality. 1. You execute an INSERT, UPDATE, DELETE, SELECT and then 2. You process the result of that command. So for every SELECT, INSERT, UPDATE and DELETE, you need to have a callback function.
This callback function follows a specific variable specification in its construct as depicted below.
where fields_update is the name of my callback function and this SHOULD be specified on ExecuteCallBack for any of my commands.
NB: BANanoSQL uses INDEXDB which stores content in the browser. You will have to have some way to persist the data somewhere else if you need to.
So in this thread we will do a couple of things..
1. Create a database + Open Event
2. Create a table + ExecuteCallBack
3. Look at (CREATE/INSERT + ExecuteCallBack) and (UPDATE + ExecuteCallBack)
4. Look at READ + ExecuteCallBack
5. Look at DELETE + ExecuteCallBack
For a background, please take a look at the first link in this post. What will differ here is the removal of SQLExecuteResult and just additional CallBacks for each SQL command, the approach is very much similar.
Other Related Topics
Create a CRUD app using LocalStorage BackEnd and Working with BANanoSQL
Some time ago, I wrote a piece here on... [BANano]: BANanoSQL CRUD-ing around with BANanoSQLUtils.
That approach followed, SQLExecuteResult methodology of doing things, where there was a single method to rule them all, i.e. all the database functions are managed by one function. From version 2.15+ of BANano, there was a callback functionality that was added to BANanoSQL due a request I made. What a Marvel!
I've been exploring the logic behind this methodology and its quite impressive and rather simple. The ExecuteCallBack BANanoSQL functionality should be thought of as some kind of pairing functionality. 1. You execute an INSERT, UPDATE, DELETE, SELECT and then 2. You process the result of that command. So for every SELECT, INSERT, UPDATE and DELETE, you need to have a callback function.
This callback function follows a specific variable specification in its construct as depicted below.
B4X:
Sub fields_update(success As Boolean, Result As List, Reason As String) 'ignore
where fields_update is the name of my callback function and this SHOULD be specified on ExecuteCallBack for any of my commands.
NB: BANanoSQL uses INDEXDB which stores content in the browser. You will have to have some way to persist the data somewhere else if you need to.
So in this thread we will do a couple of things..
1. Create a database + Open Event
2. Create a table + ExecuteCallBack
3. Look at (CREATE/INSERT + ExecuteCallBack) and (UPDATE + ExecuteCallBack)
4. Look at READ + ExecuteCallBack
5. Look at DELETE + ExecuteCallBack
For a background, please take a look at the first link in this post. What will differ here is the removal of SQLExecuteResult and just additional CallBacks for each SQL command, the approach is very much similar.
Other Related Topics
Create a CRUD app using LocalStorage BackEnd and Working with BANanoSQL
Last edited: