RE: New UseMySQLDatabase() in 5.70

Just starting out? Need help? Post your questions and find answers here.
User avatar
blueb
Addict
Addict
Posts: 1041
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

RE: New UseMySQLDatabase() in 5.70

Post by blueb »

Trying out the new commands in 5.70....

I can create 'tables' in MariaDB, but have no luck when I try to create a 'database' in MariaDB (MySQL)


Using the SQLite method... does not apply to MariaDB.
If CreateFile(0, DatabaseFile$)
CloseFile(0)
endif


I believe I can create a database using HeidiSQL (included with MariaDB)... but how to do this with PureBasic?
- It was too lonely at the top.

System : PB 6.10 Beta 9 (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
User avatar
Ajm
Enthusiast
Enthusiast
Posts: 234
Joined: Fri Apr 25, 2003 9:27 pm
Location: Kent, UK

Re: RE: New UseMySQLDatabase() in 5.70

Post by Ajm »

Mysql is not a file based database like SQLite. You will need to issue a create database statement in the same way you issue create table statements. e. g CREATE DATABASE test

Regards

Andy
Regards

Andy

Image
Registered PB & PureVision User
infratec
Always Here
Always Here
Posts: 6818
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: RE: New UseMySQLDatabase() in 5.70

Post by infratec »

User avatar
blueb
Addict
Addict
Posts: 1041
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: RE: New UseMySQLDatabase() in 5.70

Post by blueb »

Thanks fellas... that helps.

UseMySQLDatabase() which use the opensource libmariadb.dll (found in purebasic\compilers\ dir) and brings MySQL and MariaDB support natively to PureBasic ! (sponsored by Paul)
Regarding the file libmariadb.dll
When shipping your PureBasic program, you will need to add 'libmariadb.dll' (Windows), 'libmariadb.so' (Linux) or 'libmariadb.dylib' (OSX) found in the 'PureBasic/Compilers' directory to your package.

There is no additional driver to install, all is ready to connect a MySQL or MariaDB server.
If I include it with my 'compiled' program, can I create a database file, etc. with my executable and have it all in one folder? Or do I need to have the user install MariaDB? Or at least MariaDB Connector/C ? :?
- It was too lonely at the top.

System : PB 6.10 Beta 9 (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1243
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Re: RE: New UseMySQLDatabase() in 5.70

Post by Paul »

blueb wrote:Thanks fellas... that helps.

If I include it with my 'compiled' program, can I create a database file, etc. with my executable and have it all in one folder? Or do I need to have the user install MariaDB? Or at least MariaDB Connector/C ? :?
The SQLite database format requires you to create a file on your hard drive and then the database is built by accessing that file.

MariaDB/mySQL or PostgreSQL require database servers to be installed somewhere, either local or remote. You then connect to those servers using the PB Database commands.
If your app uses these formats then the end user must have the appropriate database server software installed.
Image Image
infratec
Always Here
Always Here
Posts: 6818
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: RE: New UseMySQLDatabase() in 5.70

Post by infratec »

If your user want's to access a web server, then the web server have to run somewhere.
If he needs a private web server at his PC he have to install a web server.
If he want's to access a 'public' web server via the internet this server must be up and running.

Same as for a database which is accessable via the internet.

And no, when ths database server is in the internet, then the user needs only the dll beside the exe.

And I alreday made some feature requests that TLS has to be working for all network related stuff.
Also for database access.

As a workarround I programmed a PostgreSQL SSL Proxy (TLS)
User avatar
blueb
Addict
Addict
Posts: 1041
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: RE: New UseMySQLDatabase() in 5.70

Post by blueb »

Paul wrote: ... MariaDB/mySQL or PostgreSQL require database servers to be installed somewhere, either local or remote. You then connect to those servers using the PB Database commands.
If your app uses these formats then the end user must have the appropriate database server software installed.
Wishfully thinking that maybe the DLL would provide the same benefits of Firebird's Embedded Server.

see: https://www.firebirdsql.org/manual/fbme ... edded.html

Other than that, MariaDB was extremely easy to use and install. I may transition from Postgres. {grin}
- It was too lonely at the top.

System : PB 6.10 Beta 9 (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
Post Reply