RE: Data type mapping in mysql
Santlal J Gupta <[email protected]> Thu, 12 Jan 2017 05:46:40 +0000
| Newsgroups | gmane.comp.db.mysql.java |
|---|---|
| Message-ID | <[email protected]> |
Thanks for your valuable reply.=20 -----Original Message----- From: Mark Matthews [mailto:[email protected]]=20 Sent: Tuesday, January 10, 2017 8:47 PM To: Santlal J Gupta; [email protected] Cc: Pushpender K Garg Subject: Re: Data type mapping in mysql On 01/10/2017 12:39 AM, Santlal J Gupta wrote: > Hi, > > I am new to Mysql datatype.I have created table with FLOAT data type. > I saw in MysqlDefs class that Float is map to FIELD_TYPE_FLOAT in "=20 > mysqlToJavaType(String mysqlType)" method and then again=20 > FIELD_TYPE_FLOAT is map to Types.REAL in "mysqlToJavaType(int=20 > mysqlType)" method > > I have below question: > Why FIELD_TYPE_FLOAT is mapped to Types.REAL, can it be mapped to Types.F= LOAT instead of Types.REAL? Hi, It's because even though MySQL uses the word "FLOAT" to describe this type,= the type actually fits the SQL standard type of REAL in terms of how it wo= rks (storage/precision). One can always get data type conversion via callin= g the type-specific getters in ResultSet, or passing the desired class in t= he variants of ResultSet.getObject() that take a Class<?> parameter. -Mark -- MySQL Java Mailing List For list archives: http://lists.mysql.com/java To unsubscribe: http://lists.mysql.com/java