Jump to content
  • 0

item id and mysql


Question

Posted

Hello is possible?

Im with php insered item, example:

INSERT INTO `items` (`owner_id`,`object_id`,`item_id`,`count`,`enchant_level`,`loc`,`loc_data`,`custom_type1`,`custom_type2`,`mana_left`) VALUES ('".$char['obj_Id']."',(SELECT MAX(object_id)+1 FROM items AS object_id),'".$item."','1','".$row['enchant_level']."','INVENTORY',0,0,0,-1)

then at same time game server overwrite me insered item with same object id? because some time it just put without any error, but in table the row wrong.. cant find problem

2 answers to this question

Recommended Posts

  • 0
Posted

this shit replace me insered item from web donate system.

private void updateInDb()
	{
		if (Config.ASSERT)
			assert _existsInDb;
		
		if (_wear)
			return;
		
		if (_storedInDb)
			return;
		
		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection(false);
			PreparedStatement statement = con.prepareStatement("UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,price_sell=?,price_buy=?,custom_type1=?,custom_type2=?,mana_left=? " + "WHERE object_id = ?");
			statement.setInt(1, _ownerId);
			statement.setInt(2, getCount());
			statement.setString(3, _loc.name());
			statement.setInt(4, _locData);
			statement.setInt(5, getEnchantLevel());
			statement.setInt(6, _priceSell);
			statement.setInt(7, _priceBuy);
			statement.setInt(8, getCustomType1());
			statement.setInt(9, getCustomType2());
			statement.setInt(10, getMana());
			statement.setInt(11, getObjectId());
			statement.executeUpdate();
			_existsInDb = true;
			_storedInDb = true;
			DatabaseUtils.close(statement);
			statement = null;
			
		}
		catch (final Exception e)
		{
			if (Config.ENABLE_ALL_EXCEPTIONS)
				e.printStackTrace();
			
			LOGGER.error("Could not update item " + getObjectId() + " in DB: Reason: ");
			e.printStackTrace();
		}
		finally
		{
			CloseUtil.close(con);
			con = null;
			
		}
		
		if (_existsInDb)
			fireEvent(EventType.STORE.name, (Object[]) null);
	}

any solution? or ideas?

  • 0
Posted

ok found one solution. I see all object id start at 26*******, example 268438424, for web donate system i make start id 16*******, example 160000001 with incresement, maybe its not good?

so why in every server object id start with 26*******???

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock