SFSObject mapping to MySQL query

Post here your suggestions for new possible features in SmartFoxServer 2X.

Moderators: Lapo, Bax

User avatar
marsoups
Posts: 167
Joined: 14 Apr 2008, 03:30

SFSObject mapping to MySQL query

Postby marsoups » 14 Apr 2015, 09:21

Hi!

I'd like to make a request that I think will be pretty useful to development, as often times there are cases where using the db.executeQuery(query, obj[]) method is very useful, but there is a limitation if there is an "AS" alias in the query. Sometimes the "AS" clause (eg. SELECT `id` AS user_id ) is required in a query because two fields in a cross-query have the same name, or you'd like to conveniantly shorten the field names and package them as such into the SFSObject.

On testing, I found that the ResultSetMetaData from a ResultSet contains two functions : getColumnLabel() and getColumnName()

The getColumnName() method uses the original name and not the new alias, so I was wondering if it's possible to use the getColumnLabel() instead from the ResultSetMetaData, as this is more conveniant to structure the resulting SFSObject with ease. In some situations, there is no choice but to manually generate the SFSObject, in such circumstances.

Another request is to allow tinyint(1) types as Boolean objects in a result, otherwise there is an error appearing

Code: Select all

serialization.DefaultSFSDataSerializer     - Skipping Unsupported SQL TYPE: -7


Thanks
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: SFSObject mapping to MySQL query

Postby Lapo » 15 Apr 2015, 08:13

Hi,
we'll investigate the getColumnLabel() and getColumnName() options. If there are no side effects from switching to the other, with the added bonus of aliasing, we'll use that instead.

The problem with TinyInt is that in JDBC it is defined as an 8-bit integer, the equivalent of the native type byte, not a Boolean. So this would be more of a MySQL-specific trick, but we don't detect the database type at runtime.


thanks
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “2X Features Wish List”

Who is online

Users browsing this forum: No registered users and 15 guests