Page 1 of 1

Noob and database usage.

Posted: Mon Jan 08, 2018 10:31 am
by saboteur
Hi,

Been a longtime PB user and have decided to have a bash at converting some of my apps using SB.

I have been looking through the examples and most things are pretty straight forward, but their doesn't seem to be any examples for accessing external databases such as MySQL/MariaDB or Postgres etc.

Has anyone got any pointers or examples on how to implement this with SB ?

Thanks for any help.

Cheers

Re: Noob and database usage.

Posted: Mon Jan 08, 2018 1:31 pm
by Fred
External database are server side, so not handled by Spiderbasic. You need a script on your server and an API to access it . You can also use a CGI app built with PureBasic.

Re: Noob and database usage.

Posted: Mon Jan 08, 2018 2:42 pm
by saboteur
Fred wrote:External database are server side, so not handled by Spiderbasic. You need a script on your server and an API to access it . You can also use a CGI app built with PureBasic.
Thanks for the reply Fred & Happy New Year.

I've never really had much to do with web & CGI mostly i've used PHP which has probably spoilt me :).

Can you recomend a API or framework ? or a simple cgi script I can try and get my head around ?

Thanks again.

Re: Noob and database usage.

Posted: Mon Jan 08, 2018 2:54 pm
by Dirk Geppert
If you like to do it with PureBasic, I would recommend Spiderbyte: https://github.com/spiderbytes

Re: Noob and database usage.

Posted: Tue Jan 09, 2018 8:27 am
by saboteur
That looks intersting - thanks for the heads up Dirk.

Having had a further troll through the SB online help i saw the addition of SQLite. For one of my particular apps ( a document storage system ) this will probably suffice, but are their any problems with multiple users ( not that traffic will be high ).

Again thanks for the help.

Re: Noob and database usage.

Posted: Tue Jan 09, 2018 9:15 am
by bbanelli
saboteur wrote:Can you recomend a API or framework ? or a simple cgi script I can try and get my head around ?
I must say that using PHP with PDO has proven to be quite easy and reasonably quick for server-side communication with SpiderBasic. You can even use helper classes like this one to speed up the process.

Everything is done through JSON and data structures available in SpiderBasic, with help of related Insert/ExtractJSON() functions in SpiderBasic. It takes no more than few lines (which are copy/paste; for database initialization through PDO) and queries to communicate. You add json_decode/json_encode() from PHP and you are good to go!