Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 20:05
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, kzhao, alibaba, 7th_zorro), 650 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
InLite Database DLL #300646
12/03/09 21:52
12/03/09 21:52
Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
TSG_Torsten Offline OP

User
TSG_Torsten  Offline OP

User

Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
Hi all,

I've started developing a small data-management system (or database system? well, not really...) and programming "wrappers" for different languages.

So, after a lot of testing, crashes, ... I now want to show you the first include for lite-c.
(Thanks to Slin at this point)


But first, what is this all about?

The project is called "InLite" which means "Integrated Lightweight" Database.
It gives you the possibillity to create a database file, run simple queries, create tables, insert+delete values and - of course, get the data.

The advantage of InLite is that you have (besides the dll itselfs) no dependencies. And that you can store all the data in one file!

How InLite works?

First, you have to initalize the dll and open a new or existing database. After that, you can run SQL-Like statements, as for example:
CREATE TABLE scores (name,points,time)
INSERT INTO scores (name,time) VALUES ('Me',140)
...

If you had already worked with databases, you will see that the syntax is quite similar to "real" databases.


Get the InLite DLL here
Get the InLite lite-c include here

The first Zip contains the dll which you have to add to your project folder, and the second one a header-file for lite-c and a small example code.
There is also a text file which explains something about the sql syntax, but at the moment german only, sorry.

What should you know while working with InLite?
-InLite is free to use, but without any gurantee (Credits are welcome of course)
-InLite stores the database in RAM, so very large databases may not possible
-InLite does - by default - auto save the database
-InLite does not recognize data types!
-You may not store binary data, it wouldn't work

SQL-Limitations:
-InLite can not sort by more than one field
-InLite isn't able to perform more than one LEFT JOIN
-In Where-Queries it is not possible to set hooks


So what you may could InLite use for?
-Score-Lists, it automatically can sort and limit your table
-Profile-Manager, just create a table and insert account-names and their passwords, for example
-...

Currently, the dll doesn't offer the ability to open multiple databases or fetch different queries at the same time, that may will be implemented in future.


Comments as well as Critics are welcome

Regards
TSGames

Re: InLite Database DLL [Re: TSG_Torsten] #300803
12/05/09 12:41
12/05/09 12:41
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
Hm... you have no replies yet. And from reading this, I can't make out whether I need this or not, even though it sounds good. Have you thought about uploading a short video showing the features?
I'd like to see if this could be used for storing of data that I currently have to write individual files for...
And I've never worked with sql, so I can't tell.


~"I never let school interfere with my education"~
-Mark Twain
Re: InLite Database DLL [Re: Germanunkol] #300810
12/05/09 14:27
12/05/09 14:27
Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
TSG_Torsten Offline OP

User
TSG_Torsten  Offline OP

User

Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
You may right that I've explained it a little bit bad.

But it's hard to show the functionality of a data-management system in a video, image or something else.

You also said that you've never worked with sql so far, so it may also hard for you to imagine what you could use a database for - and how.


So I will try to make an example for you and all the others who haven't worked with sql or database so far to better understand the possibilites:

Imagine you've developed a game with, let's say, 20 levels. You now want to create highscores for this game.
Normally, you would now (probably) create for the highscores of every level a individual text file, and save them there, or may you would use the engine game_save and save the scores in different arrays.
As you may know, you've to sort the highscores, which often is confusing.

So now let us imagine you would do this in a database.
So what you would do first, create a database, and create a table highscores which could have columns like name (the name of the player), score (the points), level (which level the score is related do).
A sql creation could look like this: CREATE TABLE highscores (name,score,level)

You now have a simple structure for your scores. And you could insert all scores for every level in the same way, no need to implement different files, arrays, or whatever.
A sql insert of scores may look like this:
INSERT INTO highscores VALUES ('name_of_player',score_value,current_level)

After you've insert all the data, you don't need to worry whether you've saved the data correctly, the database will do this for you. Also, you don't even have to think about sorting or filtering.

Well, after that, of course you want to show the highscores for each level. That's quite simple since you've saved it in a database.
What do you have to do? Say the database that you want to get all the names and scores from the database - sorted by the score of course.
In a sql-expression this would look like:
SELECT name,score FROM highscores WHERE level = level_to_show ORDER BY score DESC BINARY

What does this mean? SELECT means to get some data from the database, following the fields from the table you want to get. In our example, we want to get the player name and the score. Now we have to say that we want the data from "highscores". The WHERE means that we just want to get all scores from the specific level. Now we just have to say that we want sort the whole data by the score, DESC means descending and BINARY means that we want to order it numerical, and not string-based.


This is just one of thousand examples, you could also manage all your configurations for each player-profile in a global table.
And the best of all: You just have to use one file to save all the information, forget about individual text files.
And of course, you can also easily change/edit all or specific values, delete values or whole tables, change fields of the table and much more, without worrying to code something complicated therefore.

Because InLite doesn't recognize data-types, you can easily get the data in a char-array, just look at the example in the packed download to see how it works.


I hope this may help you to understand some of the benefits and usages of a database. Maybe someone other who also has some experience in databases can explain this a bit better.

Regards
TSGames

Last edited by TSG_Torsten; 12/05/09 22:43.
Re: InLite Database DLL [Re: TSG_Torsten] #300874
12/06/09 11:39
12/06/09 11:39
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
ok, I am so using this. Perfect timing as well, today I was going to code the thing you mentioned with the multiple text files. Not for highscores, but for saving different setups...
Thanks for the example!
I still need to get the hang of a few things though.
I'll fiddle around with it and see if I have any more questions.
Thanks again^^


~"I never let school interfere with my education"~
-Mark Twain
Re: InLite Database DLL [Re: Germanunkol] #300916
12/06/09 22:44
12/06/09 22:44
Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
TSG_Torsten Offline OP

User
TSG_Torsten  Offline OP

User

Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
I've just updated the download since there were some bugs which could lead to crashes or wrong query execution in some cases. So, if you have already downloaded the file, please re-download it to make sure that your DLL and include is up-to-date.

Regards
TSGames

Re: InLite Database DLL [Re: TSG_Torsten] #301736
12/13/09 15:36
12/13/09 15:36
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
This looks useful. But as I already organised my highscores in files, it's too late. But in a new project it might be useful.
Thanks for this contribution. laugh

Re: InLite Database DLL [Re: Lukas] #301937
12/15/09 14:23
12/15/09 14:23
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
I can't get clear, is this for online use as well, to be shared with more people realtime? As like a real database?


Click and join the 3dgs irc community!
Room: #3dgs
Re: InLite Database DLL [Re: Joozey] #302107
12/16/09 17:35
12/16/09 17:35
Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
TSG_Torsten Offline OP

User
TSG_Torsten  Offline OP

User

Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
Originally Posted By: Joozey
I can't get clear, is this for online use as well, to be shared with more people realtime? As like a real database?


No, sorry. InLite is a database/data-management system in "one-file". This means you can not simply share this file on an online server. Therefore you have to use an server-client based database system such as mysql. If you want to create an online-database system, you should look for the mysql-include, setup an mysql-server and connect to it from the clients.
Btw., you're saying "like a real database". Since InLite isn't a "real" database, that has nothing to do with that fact. As for example, SQLite also manages the whole data in a file and is not used to share the data online, but it's a real database, anyway.
That's just how you want to use the database. In your case, you need a server-client based database, not a local one.

Regards
TSGames

Last edited by TSG_Torsten; 12/16/09 17:38.
Re: InLite Database DLL [Re: TSG_Torsten] #302117
12/16/09 19:26
12/16/09 19:26
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
Okay, thanks laugh


Click and join the 3dgs irc community!
Room: #3dgs

Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1