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

SQL Support

Post by Richyg »

Hi,

I've recently begun using LOVE to create an ambitious project I've had in mind for a while.

However, I need a database and I found with past ventures that SQL makes for a nice and easy database as it can be quickly called/written to. However, I've been struggling to implement SQL into Love and was wondering if anyone knew of a suitable way of doing so? If not, is there another database system that someone can suggest?

Thanks
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: SQL Support

Post by kikito »

There's no easy way to do that.

Have you considered using Lua itself to codify your data?
When I write def I mean function.
User avatar
Maggots
Prole
Posts: 27
Joined: Sat Apr 24, 2010 10:38 pm
Location: Montréal, Québec, Canada

Re: SQL Support

Post by Maggots »

...XML? ^^
iza
Prole
Posts: 10
Joined: Sat Jul 11, 2009 7:16 pm

Re: SQL Support

Post by iza »

User avatar
pygy
Citizen
Posts: 98
Joined: Mon Jan 25, 2010 4:06 pm

Re: SQL Support

Post by pygy »

LÖVE only supports IO through PhysFS. The trouble is that SQLite is not compatible it...
The same goes for other DB systems.

As already suggested, you can use Lua as a document database. Think JSON, with a Lua Syntax... Actually, SOL, the ancestor of Lua, was a data description language, XML and JSON came in much later...
Hermaphroditism is not a crime. -- LSB Superstar

All code published with this account is licensed under the Romantic WTF public license unless otherwise stated.
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 »

Actually, as my very old ticket proves, LuaSQLite is capable of using a program's native file access.
Richyg
Prole
Posts: 9
Joined: Tue May 11, 2010 7:18 am

Re: SQL Support

Post by Richyg »

Sorry for not getting back here sooner but I have had serious problems accessing the Love website in general, randomly my browsers can't find it :S

anyway,

I've been trying to implement LuaSQL but to no avail, it loads the SQL module via the Love directory but errors
"The specified procedure could not be found[]"

SQL would be the ideal answer to my plans as I have knowledge of SQL and have used it in good detail before to do a similar thing with Python.

Therefore, I've been looking to LUA to code the data but i'm still learning and its just garbage right now.

I think i almost got it to load accidently once but not sure what I did and then undid it when trying to fix it :(

If anyone has any more information on a ideal system for databases then I'm happy to hear it! :D
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: SQL Support

Post by kikito »

I'd like to know more about your idea. You don't need to tell it to me vervatim: I just want to know how SQL fits on it. Why using a database (instead of, say, a lua table) is so important?
When I write def I mean function.
User avatar
Luiji
Party member
Posts: 396
Joined: Mon May 17, 2010 6:59 pm

Re: SQL Support

Post by Luiji »

Speed. For instance, MySQL is super fast compared to single text files. Drawbacks include the requirement of a central server, etc.
Good bye.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: SQL Support

Post by kikito »

Hm.

Unless you have lots and lots of info to save (50000 records or more) a plain lua file is just going to be faster and simpler.

You see, when you parse the lua file, the file is already in memory. It is a direct access to memory. That is an order of magnitude or two faster than going to a database, which often requires disk access (unless you have so few records that they are all cached. But in that case, a lua text file would be simpler to implement).

If you had 1000000 objects to manage, then the issue isn't speed any more; it is memory. You can't hold 1000000 easily on memory. So disk access, even being slower, is the only way to do it without crashing the game.
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: No registered users and 43 guests