Page 1 of 1

SQL replace error

Posted: Fri Feb 27, 2009 6:53 pm
by John Adams
Not sure what this is... checked the code, and the right value appears to be getting passed, but with my SQL in STRICT mode, I am getting an error in SaveItem()

Code: Select all

replace into character_items (id, type, char_id, slot, item_id, creator, condition_, attuned, bag_id, count, max_sell_value, account_id) values 
(1127340675, 'NOT-EQUIPPED', 750, 2579, 2528806324, '', 247, 0,1183875888, 132, 3600379438, 150);
See the "2579"? that is supposed to be a slot... but with tinyint(3), max is 255. So I am not sure where 2579 is coming from anyway. This is logging in the first time on an empty character_items table, pulling 3 items in - bag, food, water.

Code looks fine:

Code: Select all

	string update_item = string("replace into character_items (id, type, char_id, slot, item_id, creator, condition_, attuned, bag_id, count, max_sell_value, account_id) values(%lu, '%s', %lu, %i, %lu, '%s', %i, %i, %li, %i, %lu, %lu)");
	query.RunQuery2(Q_REPLACE, update_item.c_str(), item->details.unique_id, type, char_id, item->details.slot_id, item->details.item_id, 
		getSafeEscapeString(item->creator.data.c_str()).c_str(), item->generic_info.condition, item->CheckFlag(ATTUNED) ? 1 : 0, item->details.inv_slot_id, item->details.count, item->GetMaxSellValue(), account_id);
LE, let me save you a lot of time.

LethalEncounter says, "Works on my machine".

Any ideas?

Re: SQL replace error

Posted: Fri Feb 27, 2009 7:02 pm
by John Adams
And of course, any attempt to reproduce what I just did fails, and everything works perfectly.

So chalk it up to anomalous and let's just move on. Sorry.

Re: SQL replace error

Posted: Fri Feb 27, 2009 10:00 pm
by LethalEncounter
Hmm, strange. Something to keep an eye on. let me know if you can figure out what is causing it, or it happens again.