[ANN] Remote DB Lib

Find out what's going on with LiveCode (the company), product releases, announcements, and events.

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
SoapDog
Posts: 55
Joined: Sun Apr 09, 2006 10:03 pm
Location: Niterói, RJ
Contact:

[ANN] Remote DB Lib

Post by SoapDog » Wed Jun 07, 2017 7:49 pm

DB Lib is a minimalistic database library for LiveCode that works on Desktop and Mobile and allows
you to build database-savvy apps without writing SQL directly. This post is to introduce a great new feature called Remote DB Lib. As you may know from posts on the How To Use LiveCode mailing list and forums, many developers would like to use DB Lib in their apps over the internet. Like all other database libraries that work on top of RevDB, DB Lib (until today) needed to connect directly to the database server to work and this is not a good solution for apps that work over the internet since exposing MySQL to the internet at large is a huge security risk.

Today I am releasing the first version of a drop-in replacement library called Remote DB Lib. This new library has the same API as the current DB Lib but instead of working on top of RevDB, it works alongside a matching PHP file on your server, it is this PHP file that actually talks to the database server. The Remote DB Lib picks all your DB Lib calls and packs it on an encrypted message that is sent to the PHP file where it is decrypted and executed. This library is using state of the art AES 256 encryption.

More info at: https://andregarzia.com/en/blog/introdu ... mote-dblib
http://www.andregarzia.com
http://fon.nu

bwmilby
Posts: 205
Joined: Wed Jun 07, 2017 5:37 am
Location: New Orleans, LA
Contact:

Re: [ANN] Remote DB Lib

Post by bwmilby » Sun Jun 11, 2017 5:20 am

Looks very interesting. I'll need to set up a MySQL DB on one of my servers and take it for a spin. I've got a VPS, but would try it out from the perspective of someone with just an account on the server.

If anyone needs to do a case sensitive search, the dbLike function can be pretty easily modified to form a dbGlob function (just need to change the '%' to '*' in that first switch statement). [Note: there is a bug where if you try to use dbLike after using another function on the same column it won't work as expected]

I've forked the original aagDBLib.livecodescript on GitHub with these changes and a few other things. If the changes look good, I could easily perform the same update to the new remote lib and issue a pull request.

One other idea... the two libraries could be combined into a single one. The user could either set the dbId or dbConfigA (a call to one function would put empty in the other). Then the actual calls (dbGet...) could switch based on the type of the pDatabaseConnectionA (array would use remote functions, number would use revExecuteSQL/revQueryDatabase, or if empty would switch based on which default connection was set). That would cut the code in almost half for someone that needed to access both a remote db and a local db in the same app. Here's one function as an example:

Code: Select all

command dbExecuteSQL pSQL, pDatabaseConnectionA
   if pDatabaseConnectionA is empty then
      if dbId is not empty then
         put dbId into pDatabaseConnectionA
      else
         put dbConfigA into pDatabaseConnectionA
      end if
   end if

   if pDatabaseConnectionA is a number then
      revExecuteSQL pDatabaseConnectionA, pSQL
   else
      remoteExecuteSQL pDatabaseConnectionA, pSQL
   end if

   put the result into theError
   put empty into dbA
   return theError
end dbExecuteSQL
Thanks,
Brian
Brian Milby

Script Tracker https://github.com/bwmilby/lc-misc/tree/master/ScriptTracker

SoapDog
Posts: 55
Joined: Sun Apr 09, 2006 10:03 pm
Location: Niterói, RJ
Contact:

Re: [ANN] Remote DB Lib

Post by SoapDog » Tue Jun 13, 2017 5:59 pm

Brian,

I like your idea. I initially separated them because I envisioned doing much more refactoring to enable it to work like I wanted. Maybe I should merge them again. I will do some tests here. Thanks a lot for the feedback. I will implement new functions such as your glob one too.

Cheers
andre
http://www.andregarzia.com
http://fon.nu

teriibi
Posts: 254
Joined: Mon Nov 13, 2017 3:49 pm
Location: Bolivia

Re: [ANN] Remote DB Lib - configuring the demo-

Post by teriibi » Wed Dec 06, 2017 2:46 am

Hi experts :)

I´m looking for some kind helper in order to configurate the file contacts-demo.livecode from coder Andre´s DBLIB in order to acces some Https / Mysql DB.
All the PHP files are in server´s folder working with PW etc.
If someone has done it already for the same Mysql use and could send me the file (removing any PW) that would be really great.
else, I just can´t get right this client stack - having lack of knowledge (and time now)
:idea: :!: :?:

Original zip was downloadded from :
https://github.com/soapdog/livecode-dblib

(I havent found the nec help from the included PDF - overbusy coder, and though I ve been through many tutos - ALREADY - they ALL slightly differ from this case which get me to non-issue ways everytime !) :|

thanks very much to all experienced users of this specific DBLIB !

Post Reply

Return to “Announcements”