Just starting out? Need help? Post your questions and find answers here.
saboteur
 
Posts: 3
Joined: Mon Jan 08, 2018 10:25 am

Noob and database usage.

by saboteur Mon Jan 08, 2018 10:31 am

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
Fred
Site Admin
 
Posts: 1013
Joined: Mon Feb 24, 2014 10:51 am

Re: Noob and database usage.

by Fred Mon Jan 08, 2018 1:31 pm

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.
saboteur
 
Posts: 3
Joined: Mon Jan 08, 2018 10:25 am

Re: Noob and database usage.

by saboteur Mon Jan 08, 2018 2:42 pm

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.
Dirk Geppert
 
Posts: 58
Joined: Fri Sep 22, 2017 7:02 am

Re: Noob and database usage.

by Dirk Geppert Mon Jan 08, 2018 2:54 pm

If you like to do it with PureBasic, I would recommend Spiderbyte: https://github.com/spiderbytes
saboteur
 
Posts: 3
Joined: Mon Jan 08, 2018 10:25 am

Re: Noob and database usage.

by saboteur Tue Jan 09, 2018 8:27 am

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.
bbanelli
 
Posts: 96
Joined: Mon Jul 13, 2015 7:40 am

Re: Noob and database usage.

by bbanelli Tue Jan 09, 2018 9:15 am

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!
"If you lie to the compiler, it will get its revenge."
Henry Spencer
http://www.pci-z.com/
Return to Coding Questions

Who is online

Users browsing this forum: No registered users and 1 guest