Error when attempting to add to a database

Post Reply
tehngion
Posts: 8
Joined: Tue Feb 03, 2015 3:04 am

Error when attempting to add to a database

Post by tehngion »

I have a series of scripts set up for storing information about the areas I visit in Aardwolf into a database. Up until recently, these scripts have functioned exactly as they should, but now I'm getting an error message any time a particular function attempts to add information to the database. No idea what could have changed, to be perfectly honest. I haven't altered the scripts for those functions at all. The error message in particular is "LuaSQL: SQL logic error or missing database".

I double-checked, and the database file is definitely still present. I was having a similar problem with another database that I couldn't write to (though I didn't check the error message - wasn't aware that I could at the time) that I ended up solving by deleting the database and starting over. Been working fine since. This database, however, I'm a bit more attached to and would really rather fix whatever the problem is rather than give up on it. Any ideas?

I've attached the database, if it helps at all.
Attachments
Database_mapperdb.db
the troubled database
(20 KiB) Downloaded 284 times

tehngion
Posts: 8
Joined: Tue Feb 03, 2015 3:04 am

Re: Error when attempting to add to a database

Post by tehngion »

Okay, I messed around with it some more, and it seems it's only certain areas (possibly only one?) that aren't being added successfully to the database. It's working perfectly fine with other areas still. No differences that I can tell between the area I'm having problems with and the other areas.

Schema for the sheet:
Code: [show] | [select all] lua
	areas={
		name="",
		shortName="",
		areaID="",
		entranceID="",
		levelLow="",
		levelHigh="",
		_unique = { "shortName" }
	}
Code snippet being used to add to the database:
Code: [show] | [select all] lua
local whatever, message = db:add(mapperDBref.areas, areaTable)
-- DEBUG:
display(areaTable)
display(message)

-- Example of an areaTable that worked:
{
  levelHigh = "80",
  name = "The Three Pillars of Diatz",
  shortName = "diatz",
  areaID = "186",
  levelLow = "60"
}

-- The one that absolutely refuses to be added:
{
  levelHigh = "15",
  name = "Art of Melody",
  shortName = "melody",
  areaID = "183",
  levelLow = "1"
}
I'm leaning a bit more towards the possibility there's an issue with my code, but what could it be if almost every other area's working fine?

User avatar
SlySven
Posts: 1023
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Error when attempting to add to a database

Post by SlySven »

How recent is your code? There have been some recent changes (in preview "-delta" I think) to enforce uniqueness in area names in the Mudlet map data where there were some circumstances previously that could permit duplicate (or empty) Area names (which actually breaks some of the code). That being the case there might be problems if the database tries to refer to areas that are rejected now by the map code - look for error message in the main console are the map is loaded as these issues are "fixed" (with "_001", "_002"... type suffixes or "Unnamed Area", "Unnamed Area_001"... new names) I am not saying this is your problem, but it might have a bearing...

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Error when attempting to add to a database

Post by Vadi »

This is using a SQLite database, not the mudlet mapper database.

User avatar
SlySven
Posts: 1023
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Error when attempting to add to a database

Post by SlySven »

Yeah, I spotted that but I was just tossing in the idea that if any database validation or other related code was being using to verify the areas against the Mudlet Mapper database it might now fail when doing that.

Post Reply