ID:64135
 
Resolved
Fixed in 443
BYOND Version:436
Operating System:Windows XP Pro
Web Browser:Firefox 3.0.8
Video Card:
Component:Dream Maker
Game/Hub:
Status: Resolved (443)

This issue has been resolved.
Descriptive Problem Summary:
BYOND's Dantom.DB library fails to retrieve "data type" information for the columns it returns. Not only that, it does not seem to be converting the returned values into the proper format and just leaves it as text (where as it could contain a number for example).

Numbered Steps to Reproduce Problem:
Simply request some data from a database. It won't retrieve the sql_type at all, nor does it convert the integer values properly (it's all text).

I've taken the liberty of creating a demonstration project to show the problems.
You can find it here.

(another note. it seems to be setting the table value to the column's name. and I think the length values are a little off as well)

Expected Results:
It'd retrieve the given information along with converting the value of the column to its proper data type.

Actual Results:
It does neither.

Does the problem occur:
Every time? Or how often? Every time.
In other games? Yes.
On other computers? Yes.
In other user accounts? Yes.

When does the problem NOT occur?
Never.

Workarounds:
Some method of determining if the value should be considered a string or an integer.
This problem is occurring due to a change in the column field structure. The mysql plugin is assuming it is based off mysql 3.X but you are probably running 4 or 5. I'm not sure why they made their C-API backwards incompatible (the DB layer-- which is a general setup that can support any SQL-- only uses stuff present in 3.X).

There are a couple of workaround options here, so we'll look into those.
Note: table data is always returned in text format, but you can test the returned 'flags' parameter to see if it should be treated as a number:
var/isnum = (column.flags&IS_NUMERIC)!=0

We could update Dantom.DB to do this conversion before returning the result; however, it would incur extra overhead per query, to grab the flags.