CreateDatabase command

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
LJ
Enthusiast
Enthusiast
Posts: 177
Joined: Wed Apr 30, 2003 4:00 pm

CreateDatabase command

Post by LJ »

Would like a command called CreateDatabase that creates a database file (.mdb or another format if license issues are a problem). It's a little silly to have all 18+ commands for databases and yet not the ability to create one.

Note: I do not want to see any messages replied to this one with things like "get SQLITE" or "Fred doesn't have time for this", or "read the ODBC help document of Windows". :evil:
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

The commands use ODBC and the SQL language to be work, so to create a database, you will have to use the SQL langage. It would be silly to add a createdatabase() command which force the users to only one format when many cool database manager are here (mySQL, PostGres, Oracle etc...). It yes, you will have to read some documents to use the database library. Another library could be done to create again a database manager directly integrated in PB, but I don't see the point, as the performances/features will be ridiculous compared to other database managers.
LJ
Enthusiast
Enthusiast
Posts: 177
Joined: Wed Apr 30, 2003 4:00 pm

Bottom line...

Post by LJ »

You write:
"It would be silly to add a createdatabase() command which force the users to only one format when many cool database manager are here (mySQL, PostGres, Oracle etc...). "

Agreed. But what I'm talking about is added functionality not limiting options. If a user uses the createdatabase() command, then a database is created that uses a ".pdb" extension (Purebasic Data Base). If a user uses UseDatabase(x) command, then they are using the pdb format. For example:
CreateDatabase(Gadget#1, "mydatabase")
UseDatabase(Gadget#1)

Now any commands following are using Purebasic's built in .pdb inhouse database format.

If a user wants to use mySQL, PostGres, Oracle, etc... then they simply don't use the CreateDatabase command, or they UseDatabase a database that was not created with the CreateDatabase command.

The idea being that a user should be able to create some sort of Database from Purebasic. As it stands, Purebasic itself is unable to create a database. It can modify an already created database, but in and of itself, it is uncapable of creating a database. This seems silly. It is like being able to use ReadFile, ReadData, ReadLong, ReadByte, WriteData, WriteLong, WriteByte, even DeleteFile, but not being able to use CreateFile or OpenFile to actually make a file (do we say you do not need to use CreateFile, you can use NotePad to make .txt files, Wordpad or Word to make .doc files or all sorts of other programs to make different files and so you do not need to be able to create a file in Purebasic?).

If you'll notice, many new customers ask the same question over and over again in the Beginners forum. How do I create a database file? The current answer is, well you can't. Purebasic itself cannot create a database file.

You have to download SQLite, install a .DLL in your projects directory, install another Library file in the Libraries folder, and if something goes wrong, well you have to rely on the kindness of others because, Purebasic itself doesn't support the creating of database files and therefore there is no Help code in the Purebasic Help system for doing this, and no sample code that comes with Purebasic.

A much better answer is a command, CreateDatabase(Gadget#,Filename$), and then this same question would not happen over and over again for it would be in the Purebasic Help section and have sample code also.

Okay so that's my opinion. You are the boss and so if you disagree, you disagree. Even if Purebasic can't create a database file, it's still the best language to me. Just a suggestion.
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

Developing a proprietary PureBasic SQL database doesn't seem feasible to me. It would take a very long time to get such an engine up to snuff to compete with Access or SQLite and couldn't ever come close to competing with the "real" RDBMSs out there (PostgreSQL, Oracle, SQL Server, MySQL etc)..

I'd love to see SQLite bundled and supported out-of-the-box in PureBasic but I know that in itself is a whole lot of work!

Good idea, I really wish it was more feasible...
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
LJ
Enthusiast
Enthusiast
Posts: 177
Joined: Wed Apr 30, 2003 4:00 pm

Karbon

Post by LJ »

@Karbon,

I didn't ask you if it was feasible or not, nor did I ask for your dissenting opinion. I told you I didn't want to see any messages from other people criticizing a feature request I ask for. The message is for the Purebasic company and/or Fred. If Fred says no, then it's no, that's all. If I wanted to read your comments, I would have posted my request in another forum or asked you personally what you thought about it. I don't want to feel like everytime I ask for a feature request, I'm going to get jumped on by other people and then waste my precious time defending my request and the reason I want this feature.
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1282
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post by Paul »

For future reference, I would suggest that if you do not want a response to something you post... just Email Fred directly !!

Hello !?! This is a public forum.

If people have an opinion/comment/concern on something posted they are going to respond, whether someone likes it or not.

The only way to not get a response is to not post, but then it wouldn't be much of a forum now would it? ;)
Image Image
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Databases

Post by Fangbeast »

LJ, I don't want to get you mad at me either but...the last time I asked if PureBasic can create databases, someone told me "Yes" and showed me how.

Okay, there is no PureBasic command to CreateDatabase() and the solution is an mostly API one but I can create SQL databases from Purebasic using a mixture of PureBasic and API commands and it is great. No SQlite or other DLL's needed.

Now that I am slowly learning my way, ALmost everything I write now use SQL from PureBAsic to create databases and manage them.

Regards.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post by LarsG »

Fangbeast: How about you post your "createdatabase" function that you use in your programs :?:
Maybe even post it in the tips and tricks section?!?
I bet that would help alot of users... :)


-Lars

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

You missed the point. PB commands can't modify, insert, update or change a record. All is relayed to the DBM trough the 'Query' functions. So yes you can create a database with current commands: DataBaseQuery("CREATE DATABASE yourdb"). See http://www.mysql.com/doc/en/CREATE_DATABASE.html for example. But what you want is an internal database manager and I agree it could be ok for very small application but if you need a database instead of a file, consider using a real one... It opens endless possibilities.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Creating databases

Post by Fangbeast »

@LarsG

I cannot take credit for this. Rings did the original functions to create databases and he posted them to the forum.

Paul added some extras to make it more functional and he posted them also.

I took the routines and adapted them to suit myself and posted the example programs somewhere here..

I don't want to post an entire program again, please search the forum first for Ring's code to create and link to databases and if you have no luck, give me your email and i'll send you what I did and how I did it.

My thanks to Rings and Paul for showing me the way.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

Looks like somebody has a case of the Mondays.

*grin*
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Post Reply