Mudlet Databases
Re: Mudlet Databases
try deleting your LuaGlobal in .config first
Re: Mudlet Databases
Just delete LuaGlobal.lua in Mudlet home. LuaGlobal.lua will be restored automatically when you start Mudlet. It's compiled into the binary to shield against corruption in cases like yours. Make sure that ~/.config/mudlet has proper file permissions.
Re: Mudlet Databases
Deleting LuaGlobal.lua was a lot better fix than trying to go back 30 or so saves, for the corruption.
As a note, I've found out that Mudlet will crash if attempting to highlight text with the mouse cursor, in the output window, if it's also trying to scroll. I'll try to post some form of an output error log when I am able.
As a note, I've found out that Mudlet will crash if attempting to highlight text with the mouse cursor, in the output window, if it's also trying to scroll. I'll try to post some form of an output error log when I am able.
Re: Mudlet Databases
So I've been messing around with the database stuff, and trying to learn luasqlite implementation. (Seriously, is it too damn hard to have a tutorial explaining HOW to actually read/alter/commit data in a friggen function?)
Well, I've been 'reloading' the script a couple hundred times.... or at least, I thought I was reloading the script. HOWEVER, now I am getting errors of being unable to reload the script, and unable to save my profile because of ... 'too many open files'. How do I close an open file, so I can save the profile??
This is the error I get when trying to save the profile
Well, I've been 'reloading' the script a couple hundred times.... or at least, I thought I was reloading the script. HOWEVER, now I am getting errors of being unable to reload the script, and unable to save my profile because of ... 'too many open files'. How do I close an open file, so I can save the profile??
This is the error I get when trying to save the profile
Code: Select all
Failed to save Rakon to location /home/chris/.config/mudlet/profiles/Rakon/current/30-03-2010#23-07-55.xml because of the following error: Too many open files
Re: Mudlet Databases
I got the settings restored, and able to reload the script file by closing out Mudlet.
Re: Mudlet Databases
Alright...seriously.. is there NO GOOD luasql tutorial out there??
EVERY single one stupid example:
Well, that's great when all you're doing is a select. Now, what about an update on preexisting fields?
I've been trying for way too damn long to get this lua implementation and sqlite3 commands down, to execute as simple update. SIMPLE @#~!@ update command!!
The following is the code I am using, to try and update a single field:
This only prints out an error about an sql cursor, which I can't get id of :
However, when I use the following function to to print out all items from the database that have the inshop status 'Y', I get nothing as a value:
So. Could anyone familiar with luasql explain to me why the update is not working, or show/link me to a better example than the one at http://www.keplerproject.org/luasql/examples.html ?
Thanks.
EVERY single one stupid example:
Code: Select all
cur = assert (con:execute"SELECT name, email from people")
-- print all rows, the rows will be indexed by field names
row = cur:fetch ({}, "a")
while row do
print(string.format("Name: %s, E-mail: %s", row.name, row.email))
-- reusing the table of results
row = cur:fetch (row, "a")
end
I've been trying for way too damn long to get this lua implementation and sqlite3 commands down, to execute as simple update. SIMPLE @#~!@ update command!!
The following is the code I am using, to try and update a single field:
Now, the echo is printing, because when I run this function I get the output to Mudlet window:
Code: Select all
-SOLD- Rakon owns: rapier1234 priced at 2000 gold
-SOLD- Rakon owns: rapier5678 priced at 2500 gold
Code: Select all
[ERROR:] object:<shop> function:<Trigger516>
<[string "function Trigger516()..."]:25: LuaSQL: there are open cursors>
Which prints out to screen... nothing. I take it this means that there are no items in the database, that meet my query.
So. Could anyone familiar with luasql explain to me why the update is not working, or show/link me to a better example than the one at http://www.keplerproject.org/luasql/examples.html ?
Thanks.
Re: Mudlet Databases
Nope, nobody is familiar with it and you'd have to write to the authors of the thing.
Re: Mudlet Databases
To see what cursors you have open, you can use the "cur:getcolnames()" function. a cursor is returned from your attempt to execute a statement.
so
cur = conn:execute(some code)
would return your cursor, and
for i,k in pairs(cur) do
echo(k.."\n")
end
would, in theory, return your open cursors for debugging by column name.
keep in mind, this is a psudocode example to illustrate how it works.
I haven't used the sqlite system yet, but if it supports transactions then the reason it's not saving what you store might be that it's not commiting the data for some reason. Try asserting it with an error message?
so
cur = conn:execute(some code)
would return your cursor, and
for i,k in pairs(cur) do
echo(k.."\n")
end
would, in theory, return your open cursors for debugging by column name.
keep in mind, this is a psudocode example to illustrate how it works.
I haven't used the sqlite system yet, but if it supports transactions then the reason it's not saving what you store might be that it's not commiting the data for some reason. Try asserting it with an error message?