Page 1 of 1

RE: New UseMySQLDatabase() in 5.70

Posted: Sun Dec 09, 2018 7:11 pm
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?

Re: RE: New UseMySQLDatabase() in 5.70

Posted: Sun Dec 09, 2018 7:28 pm
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

Re: RE: New UseMySQLDatabase() in 5.70

Posted: Sun Dec 09, 2018 7:51 pm
by infratec

Re: RE: New UseMySQLDatabase() in 5.70

Posted: Sun Dec 09, 2018 8:10 pm
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 ? :?

Re: RE: New UseMySQLDatabase() in 5.70

Posted: Sun Dec 09, 2018 9:55 pm
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.

Re: RE: New UseMySQLDatabase() in 5.70

Posted: Mon Dec 10, 2018 7:56 am
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)

Re: RE: New UseMySQLDatabase() in 5.70

Posted: Mon Dec 10, 2018 2:49 pm
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}