Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
DB Access Module for MySQL User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

2.3 Data Types

The classes RWDBColumn and RWDBValue have an associated RWDBValue::ValueType that specifies the data type of the database column or field being referenced. Mapping between this data type and the database vendor type runs in both directions:

The RWDBValue::ValueType, accessible through the type() method, are uniform across all Access Modules. For a complete explanation of the DB Interface Module data model, see Chapter 7, "The Data Model," in the DB Interface Module User's Guide, and RWDBValue in the SourcePro C++ API Reference Guide.

Table 1: Type mapping when retrieving data

MySQL Data Type RWDBValue::ValueType C++ Data Type
decimal numeric Decimal RWDecimalPortable
bigint UnsignedLongLong, LongLong unsigned long long, long long
tinyblob, blob, mediumblob, longblob Blob RWDBBlob
double Double double
float Float float
tinyint Char, UnsignedChar char, unsigned char
smallint Short, UnsignedShort short, unsigned short
integer, mediumint Long, UnsignedLong long, unsigned long
char, varchar, tinytext, mediumtext, text, longtext, enum, set String RWCString
date Date RWDate
datetime, time, timestamp DateTime RWDBDateTime1, RWDateTime
year UnsignedShort unsigned short
  1. RWDBDateTime is deprecated. Please use RWDateTime.

Table 2: Type mapping when creating tables

RWDBValue::ValueType MySQL Data Types
Blob MEDIUMBLOB if length is RWDB_NO_TRAIT. If 0<= length <= 255 TINYBLOB. If 256 <= length <=65,535 BLOB. If 65,536 <= length <= 16,777,215 MEDIUMBLOB. Otherwise, LONGBLOB.
Tiny, UnsignedTiny, Char, UnsignedChar TINYINT
Date DATE
DateTime DATETIME
Decimal (p,s) DECIMAL using precision and scale of column. If p <= 0 defaults to 8. If s <= 0 defaults to 0.
Double DOUBLE
Float (P) FLOAT if precision is RWDB_NO_TRAIT. Otherwise, FLOAT (p) using precision of column.
Int, UnsignedInt, Long, UnsignedLong INT
Short, UnsignedShort SMALLINT
LongLong, UnsignedLongLong BIGINT
String MEDIUMTEXT if length is RWDB_NO_TRAIT. If 0<= length <= 255 VARCHAR(length) using the storageLength of the RWDBColumn. If 256 <= length <= 65,535 TEXT. If 65,536 <= length <= 16,777,215 MEDIUMTEXT. Otherwise LONGTEXT.

2.3.1 Restrictions on the Use of Data Types

Table 3 outlines the known restrictions associated with each DB Interface Module value type.

Table 3: Restrictions on the use of DB Interface Module data types

RWDBValue::ValueType Restrictions
Blob No restrictions.
Char, UnsignedChar No restrictions.
Blob No restrictions
Char, UnsignedChar No restrictions
Date No restrictions.
DateTime No restrictions.
Decimal No restrictions.
Double No restrictions.
Duration This data type is not supported.
Float No restrictions.
Int, UnsignedInt No restrictions.
Long, UnsignedLong No restrictions.
LongLong, UnsignedLongLong No restrictions.
MBString This data type is not supported.
LongDouble No restrictions.
String No restrictions.
Short, UnsignedShort No restrictions.
WString This data type is not supported.
UString This data type is not supported.


Previous fileTop of DocumentContentsIndex pageNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.