sqlite javascript


Guest

Hello
connecting a sqlite database with javascript, and can give an example?
regards


decsoft

Hello,

I am not an expert in this field, but, a quick search in Google point us to this StackOverflow thread, where an sql.js project is mentioned. So take a look at all of theese resources: continue the search in Google, read the StackOverflow thread and finally take a look at the mentioned JS project and probably others if you can found them.

Anyway, remember we can deal with JSON, text files and the app's local storage "out of the box", then maybe you no need SQLite at all, except if you need to consume already existing data in SQLite...



Ade Wale

Hi romarom,

Maybe this might be useful for you:

SQLite compiled to javascript

https://github.com/kripken/sql.js/ and


Reading a Sqlite database using client-side javascript

http://captaindanko.blogspot.co.uk/2014/05/working-with-sqlite-database-using.html


Guest

prejudice and Happy Easter to all of the form, I thank you for their statements, but I can not understand the connection of a javascript file and call up the various functions in the external JavaScript file, if you could kindly vare I wrote a small example.
regards


decsoft

Hello,

Happy Easter too! Please, romarom, take a look at the External app sample included by App Builder. That sample show us how we can use Javascript from our applications. No matter if we use Javascript declared in certain Javascript file, which you know we can include in the application from the app's file's manager. On the other hand, can I ask why you need to access Sqlite?

If you want, for example, to store user's or app's options, we can do it without the need to use any external Javascript at all, for example, using the app's local storage.



Guest

with my application I always used SQLite, I believe to manage data in sqlite and a good database.


decsoft

Hello,

But you are trying to porting some application into App Builder? I say you have other options to manage data without the use of SQLite. I have anything againts SQLite, but the current browsers' support is not quite good, and we have alternatives. Depending what you want we can take one or other approach. For what kind of information you need to use an SQLite database?

P.S. Of course you can continue trying to use SQLite following the above links.



Guest

you can even change for the JSON data source, but seen from the examples of your App Bulder es. Database and to report report9 I noticed that you are using PHP as a language to access the JSON data, even here to manipulate JSON data we need PHP as a language? For Sqlite data and a long time since I use it and for language programs for Android phones, iOS, Windophone for the moment and the best.
Greetings and thanks for your availability


decsoft

Hello,

No. PHP is not needed at all to deal with JSON, except if the JSON come from a server. We can deal with JSON data (text files and "real" JSON objects) from App Builder without PHP or any server assistance. In fact, we can read and write JSON data and store it into the app's local storage (various MB at our disposition) and we can also read and write JSON text files (with more space available), using the Files Cordova's plugin, which is ready out of the box in App Builder.

As I say before, what must be our approach depend on the application we are developing.



Guest

I could think of an example of App Builder working with JSON Cordova's plugin, have just that I use your software, as I mentioned earlier I programmed with Basic4Android (basic language), if I were to buy your software I would like to understand it well.
Thank you


decsoft

Hello,

Maybe you can take a look at the samples included by the proram romarom. We no need any Cordova's plugin to deal with JSON. We can use action slike NewObject, SetObjectProp, StrSerialize, StrUnserialize, SetOption, GetOption, etc. The Report control is also capable to parse JSON automatically. We only need a Cordova's plugin (the Files plugin) if we want to store more than the Mega Bytes allowed by the app's storage, which can vary between browsers.

App Builder already includes samples which deal with JSON, however, I want to add another one (some kind of "Agenda" sample) when possible.



Guest

thanks for your time,


decsoft

No problem! :)



Tinn Aphopchung

I come from Basic4android and Basic4IOS too :D :D .I like App builder now :P
Love to see some example with sqlite database(internal app database).
Your "database" example with php web service connect mysql was very easy to understand!.


Guest

hello tim, basic4android and basic4ios course are alternative programs without knowing java well as their knowledge and basic, and indeed with the help of libraries and a good very broad forum, in the App Builder and a great software for HTML5 code and very fast, the problem that there are few resources, another problem and that written in HTML code and therefore do not support the broweser ila SQlite source data, as I noticed entering the javascript code to access Sqlite, those not familiar with java will very difficult.
regards


decsoft

Hello to all,

Update your AB copies and take a look at the new "Agenda" app sample:

Add the new Agenda app sample, which simulates an small agenda to save our contact's names, mobile numbers and notes. The point of this application is they use JSON to store the contacts' data, uses a Report control to shown the contacts information and finally uses the app's local storage to maintain the data between application executions.

Hope they can help anybody about JSON, the Report control and the app's local storage.



Tinn Aphopchung

I test new sample "Agenda" app sample.Where the path json file save? thanks


decsoft

Hello,

I test new sample "Agenda" app sample.Where the path json file save? thanks

There is no path at all, tin, but the application uses their local storage to save the JSON data.



Guest

because uses local memory, you can not even create its own JSON files in a directory eg files app?


decsoft

Hello,

because uses local memory, you can not even create its own JSON files in a directory eg files app?

Browsers don't allow a web application to save their data in the system file system. Some technologies may appear in the future, but currently they are not wide supported by the browser's vendor. If we plain to use the application in a mobile environment, then we can use the Apache Cordova's "Files" plugin (take a look at the "Files" app sample) and then we can store the JSON text in to files without problems.



Tinn Aphopchung

So,For now offline database need to use json.And online use webservice(vis php or other) to connect any database.Right?


decsoft

Hello,

Database... we can use the local storage for our application's data: options, preferences, etc. Since the local storage wanted for strings (to be saved) and we can serialize JSON objects to strings... then we can save JSON data into the app's local storage, which is something useful. But we can also saved the information in another possible way, using the same local storage.

Certainly, client side databases is not widely supported, then, if we need real databases, probably we want to use server side ones, then no matter if we want to use MySQL or any other database engine, since our client applications are abstracted of that.



Guest

hi, I'm trying to figure out how to call the functions in javascript, but as I look and simple, the example of Qecode not very understanding, on the other IDE when you put the point es (window. a list appears to function or to other commands qu I do not see) the classes of a file javascript there are not many manuals Sql.js like that, if you can better understand when a function or altrocomando within a javascript values that ristituisce with our appbuilder commands. thank you


decsoft

Hello,

Use a Javascript external function is not complicated. Supose we have a Javascript file with the below code:

Then, if we include such file using the app's file's manager, we can call to "MyCuteFunction", just by include the function's call between the StartJS and EndJS actions, just like in the below code:

About the "sql.js" we have the complete documentation here and also various samples in the project's page here. Currently App Buidler do not recognize external Javascript files in order to extract form such files their "reusable" stuff, honestly I don't know if this feature can be added in the future.



Guest

ok for example, but if I with a call to javascript I have to see the result es. (iwindow.App.RootScope.Input1.value window.MyCuteFunction = ();) I see not, and in the choir because imput1 boxes not ristituisce anything.
thank you


decsoft

Hello,

Please, take a look at the External app sample: you can see here how to change app's variables from "pure" Javascript. I don't know if any other problems can be, but, for example, in your code:

... "value" must be "Value" (case sensitive).



Guest

inserting (window.App.RootScope.Input.Value window.MyCute = Function (); and javascript files (window.MyCuteFunction = function () {text ('Hi from my cute function!');) does not return any value in box input1


decsoft

Hello,

Please, take care about your forum's posts: use the "code" tag when possible, so your messages can be readed in a better way. I am not sure if your Javascript code contains some problem or something like that, because it's difficult to read.

About your question, the next App Builder releases includes a new "External2" app sample, which show us how to use Javascript functions declared in Javascript files. You can download such "External2" from here

As you can see, we get the result of certain Javascript function in an app's variable.



Tinn Aphopchung

Maybe this is a good news to bypass browser-based storage
http://blog.ionic.io/screencast-ionic-and-sqlite/
https://pouchdb.com/


decsoft

Hello,

Thanks for sharing tin. However, I want to insist. If we want to save app's options, then the local storage can be sufficient. If we wanted more, then we can use text files. If we need a database... probably the best option today is to use a remote database, and then, any database can be used, since our apps are completely abstracted about that.



Tinn Aphopchung

yes ,I agree with you.AppOption is another idea if data is not much complicated.


Tinn Aphopchung

Some conclusion

Cordova/PhoneGap sqlite storage adapter (core version)


decsoft

Hello,

If SQLite is extremely required may can be an option.



Tinn Aphopchung
Hello,

If SQLite is extremely required may can be an option.


Maybe,Because many Mobile App use it as local database.


decsoft

Hello,

That's depend on the application tin. The problem is this is something that works only with Cordova, but, App Builder produces HTML5 applications in the first time, and, something like Cordova's plugins does not work in the browsers, just because the database supports in browsers is very low at this time.



Tinn Aphopchung
Hello,

That's depend on the application tin. The problem is this is something that works only with Cordova, but, App Builder produces HTML5 applications in the first time, and, something like Cordova's plugins does not work in the browsers, just because the database supports in browsers is very low at this time.

Yes,I know it.It difficult when debug,because you need to debug on mobile or emulator.


Guest

I've just come to the SQLite-JavaScript links because i Appbuild release point. It does nobody uses SQLite database on disk? I can read the database with Sql.js. However, update, delete, insert can not do the operation. I'm looking for three days. A lot of things written. But the link with the SQLite is provided by the fact that the registration process is made as simple as three to five lines of information written.
Why is everything so complicated? And inadequate help files.
help page of any programming language is not so simple and inadequate.
I am sorry for my English...


decsoft

Hello,

I've just come to the SQLite-JavaScript links because i Appbuild release point. It does nobody uses SQLite database on disk? I can read the database with Sql.js. However, update, delete, insert can not do the operation. I'm looking for three days. A lot of things written. But the link with the SQLite is provided by the fact that the registration process is made as simple as three to five lines of information written.
Why is everything so complicated? And inadequate help files.
help page of any programming language is not so simple and inadequate.
I am sorry for my English...

First of all, thanks very much for your interest in my work at App Builder. Databases are "complicated" because browsers' vendors don't want to compromise the users security/file system, in my opinion. Then, if you look at this webpage you can see client side databases support is not very good nowadays.

About the program's documentation, well, I try to offer the best as I can. Certainly the program's documentation is always in revision, but, I am an only guy and do not have all the resources of a big company. If you want to contribute with the program development, please, consider to purchase a license, since this is the only way the program can be up to date and well supported.

Thanks again for your interest in my work at App Builder.



Guest

I'm testing program is 15-20 days. Not a problem getting License. I'm looking for the other programs of the actions of a few lines (such as SQLite), I have my appbuild is unable to.
A lot of things I can do very cozy. However, I can not do the things that are simple for most programs.
applications should work without the Internet also need to think. MySQL and without php in database operations should be able to do.
At least, how SQLite connection with Javascript would not work if you had told a lot of people on a page.
Thank you....


decsoft

Hello,

I'm testing program is 15-20 days. Not a problem getting License. I'm looking for the other programs of the actions of a few lines (such as SQLite), I have my appbuild is unable to.
A lot of things I can do very cozy. However, I can not do the things that are simple for most programs.
applications should work without the Internet also need to think. MySQL and without php in database operations should be able to do.
At least, how SQLite connection with Javascript would not work if you had told a lot of people on a page.
Thank you....

You're welcome. If we want to store app's options then probably the "local storage" is sufficient. We can use actions like "SetOption" and "GetOption" to store options into the "local storage", and, with the help of other actions (which can serialize and unserialize JSON data) we can save more or less complex object/information in that place.

If we need more, and, if our application is intended to be deployed in the Android platform or any other Apache Cordova supported platform, then we can use the "File" plugin along the serialize/unserialize actions, in order to save data in text files, then we can overpass the limit of the "local storage", which allow us to use around 5MB.

But, while the browser's vendors don't provide a good support for databases, then App Builder can't include support for them. We can use remote databases (as you can see) if we need more than the "local storage" or the "Files" plugin for Cordova. When the client side databases are supported by the browser's vendors, then maybe App Builder can include some stuff "out of the box".



Guest

I had to use my databases have to be Sqlite. For example, to keep the 30,000 lyrics. But I do not want to use the internet connection. Or I can already use MySQL. However SQLite enough for me. All I want to do the SQLite connections and update-delete-able to make the insert operation.
Now I've ever done in the investigation, it was the only thing I do in appbuild application. You the one that I want, I can do it one page, for example, do you have information?
SQLite subject was a dejavantaj. Camera, barcode and other features also want to buy the license if it works flawlessly. However, this database work missed all my enthusiasm.


decsoft

Hello,

I had to use my databases have to be Sqlite. For example, to keep the 30,000 lyrics. But I do not want to use the internet connection. Or I can already use MySQL. However SQLite enough for me. All I want to do the SQLite connections and update-delete-able to make the insert operation.
Now I've ever done in the investigation, it was the only thing I do in appbuild application. You the one that I want, I can do it one page, for example, do you have information?
SQLite subject was a dejavantaj. Camera, barcode and other features also want to buy the license if it works flawlessly. However, this database work missed all my enthusiasm.

I am sorry, but, I explain above the reason why client side databases are not well supported. If you found a way (using Javascript, for example) to use SQLite, then you can try it, if you wanted, since App Builder's applications can be extended using "pure" Javascript. If this cannot be useful for you, then you need to found another possible program that suite your needs.



Guest

Understood thanks. I must continue to seek other then. You success ...


decsoft

Hello,

Understood thanks. I must continue to seek other then. You success ...

Always thanks you.



Tinn Aphopchung

Another way to connect Sqlite with cordova.
http://blog.bradleygore.com/2015/08/25/getting-started-with-cordova-sqlite/

Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.