Updated Azerothcore, now it can't start. MySQL Errors "Unknown column 'innTriggerId' in 'field list'" - azerothcore

Following the instructions from here: https://www.azerothcore.org/wiki/linux-keeping-the-server-up-to-date
And here: https://www.azerothcore.org/wiki/database-keeping-the-server-up-to-date
I pulled, recompiled, and double checked that my worldserver.conf had
Updates.EnableDatabases = 7
Then I ran worldserver.
It listed a lot of files were applied to the database, but that they are missing from the directory now.
Each database says that they are up-to-date
>> Auth database is up-to-date! Containing 0 new and 8 archived updates.
...
>> Character database is up-to-date! Containing 0 new and 14 archived updates.
...
>> World database is up-to-date! Containing 0 new and 702 archived updates.
However immediately after mysql errors pop up:
In mysql_stmt_prepare() id: 34, sql: "SELECT guid, account, name, race, class, gender, level, xp, money, skin, face, hairStyle, hairColor, facialStyle, bankSlots, restState, playerFlags, position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, instance_mode_mask, arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, health, power1, power2, power3, power4, power5, power6, power7, instance_id, talentGroupsCount, activeTalentGroup, exploredZones, equipmentCache, ammoId, knownTitles, actionBars, grantableLevels, innTriggerId FROM characters WHERE guid = ?"
Unknown column 'innTriggerId' in 'field list'
In mysql_stmt_prepare() id: 54, sql: "SELECT spell, category, item, time, needSend FROM character_spell_cooldown WHERE guid = ?"
Unknown column 'category' in 'field list'
In mysql_stmt_prepare() id: 216, sql: "INSERT INTO characters (guid, account, name, race, class, gender, level, xp, money, skin, face, hairStyle, hairColor, facialStyle, bankSlots, restState, playerFlags, map, instance_id, instance_mode_mask, position_x, position_y, position_z, orientation, trans_x, trans_y, trans_z, trans_o, transguid, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, extra_flags, stable_slots, at_login, zone, death_expire_time, taxi_path, arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, health, power1, power2, power3, power4, power5, power6, power7, latency, talentGroupsCount, activeTalentGroup, exploredZones, equipmentCache, ammoId, knownTitles, actionBars, grantableLevels, innTriggerId) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
Unknown column 'innTriggerId' in 'field list'
In mysql_stmt_prepare() id: 217, sql: "UPDATE characters SET name=?,race=?,class=?,gender=?,level=?,xp=?,money=?,skin=?,face=?,hairStyle=?,hairColor=?,facialStyle=?,bankSlots=?,restState=?,playerFlags=?,map=?,instance_id=?,instance_mode_mask=?,position_x=?,position_y=?,position_z=?,orientation=?,trans_x=?,trans_y=?,trans_z=?,trans_o=?,transguid=?,taximask=?,cinematic=?,totaltime=?,leveltime=?,rest_bonus=?,logout_time=?,is_logout_resting=?,resettalents_cost=?,resettalents_time=?,extra_flags=?,stable_slots=?,at_login=?,zone=?,death_expire_time=?,taxi_path=?,arenaPoints=?,totalHonorPoints=?,todayHonorPoints=?,yesterdayHonorPoints=?,totalKills=?,todayKills=?,yesterdayKills=?,chosenTitle=?,knownCurrencies=?,watchedFaction=?,drunk=?,health=?,power1=?,power2=?,power3=?,power4=?,power5=?,power6=?,power7=?,latency=?,talentGroupsCount=?,activeTalentGroup=?,exploredZones=?,equipmentCache=?,ammoId=?,knownTitles=?,actionBars=?,grantableLevels=?,innTriggerId=?,online=? WHERE guid=?"
Unknown column 'innTriggerId' in 'field list'
In mysql_stmt_prepare() id: 428, sql: "DELETE FROM item_loot_storage WHERE containerGUID = ? AND itemid = ? AND count = ? AND item_index = ? LIMIT 1"
Unknown column 'item_index' in 'where clause'
In mysql_stmt_prepare() id: 429, sql: "INSERT INTO item_loot_storage (containerGUID, itemid, item_index, count, randomPropertyId, randomSuffix, follow_loot_rules, freeforall, is_blocked, is_counted, is_underthreshold, needs_quest, conditionLootId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
Unknown column 'item_index' in 'field list'
In mysql_stmt_prepare() id: 396, sql: "SELECT spell, category, time FROM pet_spell_cooldown WHERE guid = ?"
Unknown column 'category' in 'field list'
In mysql_stmt_prepare() id: 399, sql: "INSERT INTO pet_spell_cooldown (guid, spell, category, time) VALUES (?, ?, ?, ?)"
Full output paste: https://pastebin.com/tHeTNVbW
I tried using the db_assembler tool too, but I still get the same output when I try to start the server.
Is there a step I am missing? Thank you!

Need checkout to commit - https://github.com/azerothcore/azerothcore-wotlk/commit/9e3949232cc0ad1703eb4b8bba66dd54b4246ceb
Startup core with DB auto-updates (Updates.EnableDatabases inside worldserver.conf)
Checkout to HEAD
Startup core again

This isn't a great solution, because I'm still getting errors that give me the impression that some world objects and scripts from recent updates don't work.
I went to the Azerothcore github and manually searched for the fields that were marked as missing in the mysql errors. I then copied those lines (such as 'ALTER TABLE...') and any subsequent updates/inserts to my mysql Workbench client where I ran all these updates manually until the damn thing started.
I ended up with something like this:
use acore_characters;
ALTER TABLE `characters` ADD COLUMN `innTriggerId` INT UNSIGNED NOT NULL AFTER `deleteDate`;
ALTER TABLE `character_spell_cooldown` ADD COLUMN `category` MEDIUMINT UNSIGNED DEFAULT 0 NOT NULL AFTER `spell`;
etc...
full paste: https://pastebin.com/bkLnYmys
(note: this was exactly what I needed to run, it will most likely be different for you)
It's temporary, but obviously I would rather have everything working. At this point I think my best option is to start fresh and manually import all character data manually.

Related

Using WHERE NOT EXISTS in Sqlite returns syntax error

(This relates to a Discord bot using Discord.js and sqlite v3, NOT sqlite3)
I'm currently trying to use WHERE NOT EXISTS to add a row to my Sqlite table, but only if there isn't a row where "serverid" is the ID of the current server and the type spam already.
I tried it with this:
sql.run(`INSERT INTO filters WHERE NOT EXISTS(SELECT 1 FROM filters WHERE serverid = "${msg.guild.id}" AND type = "Spam") (serverid, type, active, action, time) VALUES (?, ?, ?, ?, ?)`, msg.guild.id, `Spam`, 0, `delete`, 60)
This works if there ISN'T a row with that ID and type yet, but as soon as it does exist, I get a "syntax error at: WHERE".
It doesn't tell me which WHERE the problem is, and I double checked the syntax multiple times and it should be fine.
Does this not work in sqlite? Or did I get the syntax wrong?
The syntax of the query is wrong.
You should use INSERT ... SELECT instead of INSERT ... VALUES:
INSERT INTO filters (serverid, type, active, action, time)
SELECT ?, ?, ?, ?, ?
WHERE NOT EXISTS(SELECT 1 FROM filters WHERE serverid = "${msg.guild.id}" AND type = "Spam")`

"Row value misused" error in SQLite database

I'm getting an error from an sqlite3 query for which I can't find any reference material. Googling the string takes me deep in the SQLite code itself, and that's so opaque I can't make heads or tails of it.
The table schema:
CREATE TABLE quote (
seqnum INTEGER,
session STRING,
timestamp_sip INTEGER,
timestamp_1 INTEGER,
market_center STRING,
symbol STRING,
bid_price INTEGER,
bid_lots INTEGER,
offer_price INTEGER,
offer_lots INTEGER,
flags INTEGER,
PRIMARY KEY (symbol, seqnum) );
The query:
select (seqnum, session, timestamp_sip, timestamp_1, market_center, symbol)
from quote
where symbol = 'QQQ';
The error:
Error: row value misused
I have no idea how to proceed here. There is plenty of data in the table that would match the query:
sqlite> select count(*) from quote where symbol = 'QQQ';
2675931
Can anyone offer any guidance here? Sqlite version is 3.16.2.
Nevermind. Those parentheses around the select columns (left over from a copy/paste) are the problem. Poor error message, maybe. But my fault.
I had a similar when working with a Rails 5.2 Application.
For my case I was trying to write a search query for a model in application:
def self.search(params)
applications = all.order('created_at DESC') # for not existing params args
applications = applications.where("cast(id as text) like ?, email like ?, first_name like ?, last_name like ?, appref like ?", "#{params[:search]}", "%#{params[:search]}%", "#{params[:search]}", "#{params[:search]}", "#{params[:search]}",) if params[:search]
applications
end
The issue was that I was using a comma (,) to separate the search parameters, I simply corrected by using an OR instead:
def self.search(params)
applications = all.order('created_at DESC') # for not existing params args
applications = applications.where("cast(id as text) like ? OR email like ? OR first_name like ? OR last_name like ? OR appref like ?", "#{params[:search]}", "%#{params[:search]}%", "#{params[:search]}", "#{params[:search]}", "#{params[:search]}",) if params[:search]
applications
end
I deleted brackets from query and it work for me: from SELECT (column1, column2, ...) FROM table to SELECT column1, column2, ... FROM table
JUST
select seqnum, session, timestamp_sip, timestamp_1, market_center, symbol
from quote
where symbol = 'QQQ';
then it works.
Yeah, this bug is happing in my code, and I found this questions, but none of the answers helped me.
I fixed this problem with remove the same column in my SELECT command.
(It's stupid, because I can't select the column if the column is already in the condition subcommand.)
This is the problem SQL command (DO NOT USE THIS):
SELECT (`id`, `username`) FROM `users` WHERE `id` = 'someone_s id'
This is the fixed SQL command (PLEASE USE THIS):
SELECT (`username`) FROM `users` WHERE `id` = 'someone_s id'
The same error occurs when putting the elements of a GROUP BY clause inside brackets, as in
SELECT 1 as a, 2 as b FROM (SELECT 1) GROUP BY (a, b);
The correct syntax is, of course
SELECT 1 as a, 2 as b FROM (SELECT 1) GROUP BY a, b;

sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 6, and there are 5 supplied [duplicate]

This question already has answers here:
Programming Error: Incorrect number of bindings supplied
(2 answers)
Closed 6 years ago.
I really do not understand what am I doing wrong. My table is:
conn.execute('''CREATE TABLE USERS
(EMAIL TEXT NOT NULL,
PASSWORD TEXT NOT NULL,
FIRST_NAME TEXT NOT NULL,
LAST_NAME TEXT NOT NULL,
DATE TEXT NOT NULL,
SEX TEXT NOT NULL);''')
and when I am trying to insert to the table:
conn.executemany("INSERT INTO USERS VALUES (?, ?, ?, ?, ?, ?)", [email, password, first_name, last_name, date, sex])
I get this error:
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 6, and there are 5 supplied.
if I add a question the error is the same but now:
sqlite3.OperationalError: table USERS has 6 columns but 7 values were supplied
if I add only a comma without a question mark the error is different:
sqlite3.OperationalError: near ")": syntax error
the variables value are:
email=str(myapp.register_email.text())
print email
first_name=str(myapp.first_name.text())
print first_name
last_name=str(myapp.last_name.text())
print last_name
date=str(myapp.date.text())
print date
password="nht"
print password
sex=str(myapp.sex.currentText())
print sex
I am really getting insane here cant figure out the problem
As suggested by the Python doc, the executemany() method requires a tuple of values. Therefore I suggest you to insert the new entry by using the following code:
conn.executemany("INSERT INTO USERS VALUES (?, ?, ?, ?, ?, ?)", [(email, password, first_name, last_name, date, sex)]

ASP.NET and SQL - inserting data into more than one table?

So I know similar questions have been asked before, but I couldn't find a clear answer for my specific situation. I'm using ASP.NET (in Visual Web Developer) and I need to insert data from one form into two separate tables. This is my data source:
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/courseinfo.mdb"
SelectCommand="SELECT * FROM [tableCourse], [tableFaculty]"
InsertCommand="INSERT INTO [tableCourse]
([department], [name_first], [name_last], [prefix],
[course_number], [credits], [title], [description])
VALUES (?, ?, ?, ?, ?, ?, ?, ?); INSERT INTO [tableFaculty] ([name_first], [name_last], [phone], [email])
VALUES (?, ?, ?, ?)">
So you see I've tried using two insert statements, and it just comes back with an error saying there are extra characters after the SQL statement. I've tried taking out the semi-colon and then it says I'm missing a semi-colon. Is it possible to insert to two tables at once using this control? And if not, how do I work around this?
UPDATE:
Okay, tried it in the codebehind, but I don't think I did it right, now it's giving me this error:
Server Error in '/CCC' Application.
Index or primary key cannot contain a Null value.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Index or primary key cannot contain a Null value.
Source Error:
Line 87:
Line 88: AccessDataSource1.InsertCommand = "INSERT INTO [tableCourse] ([department], [name_first], [name_last], [prefix], [course_number], [credits], [title], [description]) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
Line 89: AccessDataSource1.Insert()
Line 90:
Line 91: AccessDataSource1.InsertCommand = "INSERT INTO [tableFaculty] ([name_first], [name_last], [phone], [email]) VALUES (?, ?, ?, ?)"
Line 89 is the one that's highlighted. So I'm thinking it's attempting to insert but for some reason the values are null, it isn't taking the values from the text boxes.
I probably left something obvious out, I don't know, I'm really new at this.
Why don't you give it a try at the codebehind?
AccessDataSource1.InsertCommand = "First INSERT Statement";
AccessDataSource1.Insert();
AccessDataSource1.InsertCommand = "Second INSERT Statement";
AccessDataSource1.Insert();

SQLite error: 'could not convert text value to numeric value.'

I've found a work-around, but I am completely perplexed by an issue I ran into with Adobe Air and SQLite. An UPDATE query that I believe worked correctly earlier in the development process suddenly started failing with the error details:'could not convert text value to numeric value.', operation:'execute', detailID:'2300'. Several hours later I found that if I included a pretty irrelevant column in the query, setting it to an arbitrary value, the problem went away. As luck would have it, this did not affect the business logic in any meaningful way, so I'm going to leave it as is. However, I detest mysteries like this. Can anyone think of what might have happened?
(Edit: Sorry, I made a mistake in my code. The last two queries were identical in my original post. In fact, the UPDATE query only worked when I also added locked = null or locked = 0 to the query. If I didn't set this value, the query would fail. I did just about everything I could to get around this, including rebuilding the database file.)
Here's the table definition:
CREATE TABLE cars (
car_id INTEGER PRIMARY KEY AUTOINCREMENT DEFAULT NULL,
cargroup_id NUMERIC,
starting_ordinal NUMERIC,
ending_ordinal NUMERIC,
locked NUMERIC
);
This query has always worked:
var query = new Query(
"UPDATE cars SET locked = (car_id = ?) WHERE cargroup_id = ?",
[intCarId,intCargroupId],
success,failure
);
This query failed with the above error ([edit]):
var query = new Query(
"UPDATE cars SET starting_ordinal = ?, ending_ordinal = ?, cargroup_id = ? WHERE car_id = ?",
[
parseInt(objPayout.starting_ordinal,10),
parseInt(objPayout.ending_ordinal,10),
parseInt(objPayout.cargroup_id,10),
parseInt(objPayout.car_id,10)
],
success,failure
);
I solved the problem by changing the query to this:
var query = new Query(
"UPDATE cars SET starting_ordinal = ?, ending_ordinal = ?, cargroup_id = ?, locked = null WHERE car_id = ?",
[
parseInt(objPayout.starting_ordinal,10),
parseInt(objPayout.ending_ordinal,10),
parseInt(objPayout.cargroup_id,10),
parseInt(objPayout.car_id,10)
],
success,failure
);

Resources