MySQL r39-2 inserting precise floats
#1

Hello, i need to save some objects cordinates into a database but when i save them, the numbers get change in the database.. i searched and i found that FLOAT, DOUBLE and other mysql row types aren't precise, so that's why my cordinates get changed.

The question is how could i save my cordinates exactly as they are in-game? I tried with DECIMAL, int, varchar, text, i don't know what should i use..

pawn Код:
mysql_format(MySQL, query, sizeof(query), "INSERT INTO gates (Model, Password, Owner, closePosX, closePosY, closePosZ, closePosRX, closePosRY, closePosRZ, openPosX, openPosY, openPosZ, openPosRX, openPosRY, openPosRZ) VALUES ('%i', '%s', '%s', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f')",
                Gate[NextID][Model],
                Gate[NextID][Password],
                Gate[NextID][Owner],
                Gate[NextID][closePosX], Gate[NextID][closePosY], Gate[NextID][closePosZ], Gate[NextID][closePosRX], Gate[NextID][closePosRY], Gate[NextID][closePosRZ],
                Gate[NextID][openPosX], Gate[NextID][openPosY], Gate[NextID][openPosZ], Gate[NextID][openPosRX], Gate[NextID][openPosRY], Gate[NextID][openPosRZ]);
                mysql_tquery(MySQL, query, "OnGateCreate", "i", NextID);
I think i should use DECIMAL, but: should i make a system to get amount of characters of the hole float and amount of characters behind the coma and insert it into the database with "DECIMAL(characters,characters behind coma) ? I really don't know if there is an easier way..

Thanks for reading, scope.
Reply


Messages In This Thread
MySQL r39-2 inserting precise floats - by The_Scope - 10.01.2015, 14:09
Respuesta: Re: MySQL r39-2 inserting precise floats - by The_Scope - 10.01.2015, 14:21
Respuesta: Re: MySQL r39-2 inserting precise floats - by The_Scope - 10.01.2015, 14:32
Re: MySQL r39-2 inserting precise floats - by Vince - 10.01.2015, 15:31
Respuesta: Re: MySQL r39-2 inserting precise floats - by The_Scope - 10.01.2015, 17:09

Forum Jump:


Users browsing this thread: 1 Guest(s)