SQL Support

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Richyg
Prole
Posts: 9
Joined: Tue May 11, 2010 7:18 am

Re: SQL Support

Post by Richyg »

okay to break down the idea and where I'm at...

The game idea is a sports management simulation for a sport I've designed from scratch. The details of this aren't really important.

The game requires a considerably large database. One league will have around 20 teams and each team around 20 to 30 players (call it 25) plus staff etc. So each league has around 500 players. Each nation is likely to have on average 4 leagues (divisions) and this is to spread accross many nations (potentially 100+). So I'm talking around 200,000 players as a guideline but I want it to be able to handle more than this as I've designed it to be a dynamic world where new leagues, players and clubs are added as the interest in the sport expands.

As concerns my developments. I've got SQL to work to a certain extent, except it it unable to parse variables into the queries. From what I can understand from what I've read this is a LUA issue with SQLite3.

I'm not hardened to using SQL but is it possible to create such an extensive relational database in another way??
User avatar
pygy
Citizen
Posts: 98
Joined: Mon Jan 25, 2010 4:06 pm

Re: SQL Support

Post by pygy »

Aaargh. :-( the phone ate my beautiful answer :-(

You could build it using Lua tables.

Use a tree, with, for each level, a reference to its parent, and an index.

Code: Select all

for _, team in pairs( AllPlayers[uid].team.division.teams ) do
    SomethigWithThe( team )
end
Stats on all players/teams would be expensive, but they could be boosted by using data structures adapted to the tasks at hand.

You can save the data to disk by using a strategy similar to this (the code is for Lua 4), or this (it uses SQLite for storage, which is of no use here, but there could be good ideas for data marshalling). use one file per table.

For efficient loading, you could use the memoization example in the PiL chapter about weak tables.
Richyg
Prole
Posts: 9
Joined: Tue May 11, 2010 7:18 am

Re: SQL Support

Post by Richyg »

@pygy - Thanks for the info because I think its led me to my solution.

lua-sqlite3!

http://www.nessie.de/mroth/lua-sqlite3/ ... ation.html

However, I'm not understanding the whole makefile stuff so has anyone got experience in doing this? if so I can get a dll and it has the functionality to bind variables to lua! basically giving me what I've been looking for all along! :D
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: SQL Support

Post by nevon »

Richyg wrote:However, I'm not understanding the whole makefile stuff so has anyone got experience in doing this? if so I can get a dll and it has the functionality to bind variables to lua! basically giving me what I've been looking for all along! :D
In Linux you just have to do:

Code: Select all

./configure <options>
make
make check
sudo make install
But I don't know if that's how you do it in Windows as well.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: SQL Support

Post by bartbes »

You don't, unless you have mingw32 or cygwin, check for visual studio project files (and install visual studio if they exist)
Richyg
Prole
Posts: 9
Joined: Tue May 11, 2010 7:18 am

Re: SQL Support

Post by Richyg »

I really can't get these make files to work.
I've been trying to use Visual Studio's command prompt and nmake function and it keeps erroring that there is an illegal character which is bizaare!

I trolled the net to find someone is using this wrapper for the very thing I'm trying to use it for so I'm really peeved i can't get it :(
Richyg
Prole
Posts: 9
Joined: Tue May 11, 2010 7:18 am

Re: SQL Support

Post by Richyg »

Sucess at LAST!!!!

I found a lsqlite3.dll file randomly on the net and it works. I've got bound variables working to find individual records in my sqlite3 database meaning I can finally continue with my project.
Maybe I can get some of my developments in order to show you all what the fuss was for at some point :D

If anyone needs the file you can get it here...
http://www.autoplaymediastudio.com/uplo ... ile_53.zip
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: SQL Support

Post by Jasoco »

Will it work cross-platform? DLL drums up fears of Windows exclusivity.
Richyg
Prole
Posts: 9
Joined: Tue May 11, 2010 7:18 am

Re: SQL Support

Post by Richyg »

It may well have an issue between PC and MAC. I'm developing for PC, any MAC developments will be on a backburner and may require making two seperate installs with differing ways of controlling the libaries.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: SQL Support

Post by Robin »

And not to forget Linux.

Now, the great thing with LÖVE (and Lua) is that cross-platformness doesn't cost you anything: it's the default, so to say.

You're free to include DLLs (as long as their licenses permit that, of course), but it strikes me as unlövely to say the least.
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 12 guests