JavaScript and local databases..

Moderator: Rathinagiri

Post Reply
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

JavaScript and local databases..

Post by Roberto Lopez »

Hi All,

HMGSCRIPT could be used to create fully local applications.

In such case you don't need any web server, you must open the main app html file and it will work.

But... what about a local databases?

You surely know that JavaScript is 'sandboxed', meaning that it can't access local file system, so... how to do it?

HTML5 introduced local storage facilities.

slq.js (Sqlite compiled to JavaScript) uses HTML5 local storage to allow you to work with SQL local databases.

So... a full JavaScript app with local databases...? YES!

https://github.com/kripken/sql.js
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: JavaScript and local databases..

Post by mol »

fine news!
thanks Roberto for sharing!
Regards, Marek.
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: JavaScript and local databases..

Post by Rathinagiri »

Wow! That is very promising!
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
serge_girard
Posts: 3158
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: JavaScript and local databases..

Post by serge_girard »

Thanks, Roberto !

Serge
There's nothing you can do that can't be done...
User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines

Re: JavaScript and local databases..

Post by dhaine_adp »

Thanks Roberto this is another milestone that extends the power of HMG with its own Unicode (by Dr. Claudio) and ANSI build.
Regards,

Danny
Manila, Philippines
User avatar
apais
Posts: 440
Joined: Fri Aug 01, 2008 6:03 pm
DBs Used: DBF
Location: uruguay
Contact:

Re: JavaScript and local databases..

Post by apais »

Note: Local Storage is limited to 5MB.
Fine for phone apps but not so much for fully fledged commercial desktop apps.

HTH
Angel
Angel Pais
Web Apps consultant/architect/developer.
HW_apache (webserver modules) co-developer.
HbTron (Html GUI for harbour desktop hybrid apps) co-developer.
https://www.hbtron.com
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: JavaScript and local databases..

Post by Roberto Lopez »

apais wrote:Note: Local Storage is limited to 5MB.
Fine for phone apps but not so much for fully fledged commercial desktop apps.

HTH
Angel
You have other alternatives, ie: http://en.wikipedia.org/wiki/Indexed_Database_API
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
mruizcanete
Posts: 16
Joined: Sat Apr 19, 2014 10:17 am

Re: JavaScript and local databases..

Post by mruizcanete »

Another tool to handle sql but without the limitations of web sql storage or local storage. And it's fully documented in Spanish also.
javascriptsql.sourceforge.net/ARCH/index.html
I've tried the test and it's quite nice. Tried locally but I had to deal with the Chrome problem about file:// as starting address that I solved in windows after some googling.
Perhaps using different tools but in the same project it would be possible to build an application as it is expected: one-single page html with hmgscript, javascript.js, jquery mobile... with no servers at all, and in every compatible browser with html5.
Dreams becoming true?
Thanks to all for this big effort in these days. Merry Christmas to everybody and a happy new year from this humble Spaniard.
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: JavaScript and local databases..

Post by Roberto Lopez »

mruizcanete wrote:Another tool to handle sql but without the limitations of web sql storage or local storage. And it's fully documented in Spanish also.
javascriptsql.sourceforge.net/ARCH/index.html
I've tried the test and it's quite nice. Tried locally but I had to deal with the Chrome problem about file:// as starting address that I solved in windows after some googling.
Perhaps using different tools but in the same project it would be possible to build an application as it is expected: one-single page html with hmgscript, javascript.js, jquery mobile... with no servers at all, and in every compatible browser with html5.
Dreams becoming true?
Thanks to all for this big effort in these days. Merry Christmas to everybody and a happy new year from this humble Spaniard.
Thanks!

It looks good.

I'll test it ASAP.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
juanato
Posts: 44
Joined: Fri Sep 21, 2012 2:42 pm

Re: JavaScript and local databases.. XPCOM Mozilla

Post by juanato »

XPCOM Mozilla can assist Firefox to via storage class call from Javascript sqlite commands.

You can using GreaseMonkey or iMacros4Firefox run javascript code inside XPCOM architecture inside Mozilla Firefox.


https://www.google.es/search?q=xpcom+sq ... easemonkey
Post Reply