Skip to main content



      Home
Home » Archived » BIRT » DataTypeMapping Question
DataTypeMapping Question [message #38567] Wed, 18 May 2005 18:58 Go to next message
Eclipse UserFriend
so in the extension point DataSetType
we specify DataTypeMapping(s)

Looking at the FlatFile Driver as example

there are things like

<dataTypeMapping
nativeDataType="LONGVARCHAR"
nativeDataTypeCode="-1"
odaScalarDataType="String"/>
<dataTypeMapping
nativeDataType="DATE"
nativeDataTypeCode="91"
odaScalarDataType="Date"/>
<dataTypeMapping
nativeDataType="TIME"
nativeDataTypeCode="92"
odaScalarDataType="Time"/>


Where do the nativeDataTypeCode entries come from. In the examples
above there is "-1" "91" and "92" is this standard SQL way of describing
things?
Re: DataTypeMapping Question [message #38884 is a reply to message #38567] Thu, 19 May 2005 19:39 Go to previous messageGo to next message
Eclipse UserFriend
Mike,

The data type mapping is a convenience provided by ODA so that your code can
expose all its native data types, and the ODA consumer can tell you how to
do the mapping from native to Java data types. For example, one client might
want to convert a "BigInt" type to Integer, another to Float and yet another
to BigDecimal.

You can probably get by simply by exposing just the Java data types you
support. Just make up your own data type codes: 1 = String, 2 = Integer, 3 =
Float, etc.

The sample flat file data source is perhaps a bit overly complex: it tries
to implement a mini-SQL engine, complete with a simplified SELECT syntax and
simulated SQL data types. You can build a driver that is far simpler by
letting BIRT do the sorting & filtering, or by providing your own custom UI
and properties to specify filters.

Time permitting, we may be able to put a simplified example on the web site
in the month after BIRT ships, once the ODA API settles down.

- Paul

Paul Rogers
BIRT PMC

"Mike Boyersmith" <mjboyers@us.ibm.com> wrote in message
news:d6ghcl$6oc$1@news.eclipse.org...
> so in the extension point DataSetType
> we specify DataTypeMapping(s)
>
> Looking at the FlatFile Driver as example
>
> there are things like
>
> <dataTypeMapping
> nativeDataType="LONGVARCHAR"
> nativeDataTypeCode="-1"
> odaScalarDataType="String"/>
> <dataTypeMapping
> nativeDataType="DATE"
> nativeDataTypeCode="91"
> odaScalarDataType="Date"/>
> <dataTypeMapping
> nativeDataType="TIME"
> nativeDataTypeCode="92"
> odaScalarDataType="Time"/>
>
>
> Where do the nativeDataTypeCode entries come from. In the examples
> above there is "-1" "91" and "92" is this standard SQL way of describing
> things?
>
>
Re: DataTypeMapping Question - part 2 [message #39458 is a reply to message #38884] Mon, 23 May 2005 19:07 Go to previous messageGo to next message
Eclipse UserFriend
Ok more questions, So say I have a data type that is Java String

and I create the following entry in my manifest (using other examples
for reference)

<dataTypeMapping
nativeDataType="VARCHAR"
nativeDataTypeCode="152"
odaScalarDataType="String"/>


so this is how I read this at the moment:

nativeDataTypeCode = some made up code that represents the translation
to from NataiveDatatype to odaScalarDataType, driver assigned

odaScalarDataType = something ODA knows how to map to, String, Integer,
Boolean (A java type), My Class that class loader can find?

nativeDataType = native meaning machine representation of it? or
language rep? not sure where we get the string VARCHAR from


Q: Can I have complex odaScalarDataType="MyHugeJavaClass" and the
classloader will find the class for this guy and load it?

Q: It seems that the nativeDataType possible values are hard coded
somewhere java.sql.types? or what is the set of valid values for this?
where are they defined? not sure I get this entry.sorry I'm thick headed
at times. Seems birt Oda framework uses java.sql types for this?


Thanks for any help here, just hard to understand this.



Paul Rogers wrote:
> Mike,
>
> The data type mapping is a convenience provided by ODA so that your code can
> expose all its native data types, and the ODA consumer can tell you how to
> do the mapping from native to Java data types. For example, one client might
> want to convert a "BigInt" type to Integer, another to Float and yet another
> to BigDecimal.
>
> You can probably get by simply by exposing just the Java data types you
> support. Just make up your own data type codes: 1 = String, 2 = Integer, 3 =
> Float, etc.
>
> The sample flat file data source is perhaps a bit overly complex: it tries
> to implement a mini-SQL engine, complete with a simplified SELECT syntax and
> simulated SQL data types. You can build a driver that is far simpler by
> letting BIRT do the sorting & filtering, or by providing your own custom UI
> and properties to specify filters.
>
> Time permitting, we may be able to put a simplified example on the web site
> in the month after BIRT ships, once the ODA API settles down.
>
> - Paul
>
> Paul Rogers
> BIRT PMC
>
> "Mike Boyersmith" <mjboyers@us.ibm.com> wrote in message
> news:d6ghcl$6oc$1@news.eclipse.org...
>
>>so in the extension point DataSetType
>>we specify DataTypeMapping(s)
>>
>>Looking at the FlatFile Driver as example
>>
>>there are things like
>>
>> <dataTypeMapping
>> nativeDataType="LONGVARCHAR"
>> nativeDataTypeCode="-1"
>> odaScalarDataType="String"/>
>> <dataTypeMapping
>> nativeDataType="DATE"
>> nativeDataTypeCode="91"
>> odaScalarDataType="Date"/>
>> <dataTypeMapping
>> nativeDataType="TIME"
>> nativeDataTypeCode="92"
>> odaScalarDataType="Time"/>
>>
>>
>>Where do the nativeDataTypeCode entries come from. In the examples
>>above there is "-1" "91" and "92" is this standard SQL way of describing
>>things?
>>
>>
>
>
>
Re: DataTypeMapping Question - part 2 [message #40932 is a reply to message #39458] Tue, 24 May 2005 20:54 Go to previous message
Eclipse UserFriend
Mike,

>> Where do the nativeDataTypeCode entries come from.
>> Q: It seems that the nativeDataType possible values are hard coded
somewhere java.sql.types? or what is the set of valid values for this?
where are they defined? not sure I get this entry.sorry I'm thick headed
at times. Seems birt Oda framework uses java.sql types for this?

The native data type values are whatever values that your ODA runtime driver
exposes to represent the data types native to the underlying data source. Your
ODA driver defines the valid values. The type code values can be of any integer
values.
In other words, their values are unique and native to your data source and ODA
driver.
The native data type values defined in the plugin.xml dataTypeMapping must match
one of the data type values returned by your driver's ODA interface
implementation, such as IResultSetMetaData.getColumnType and getColumnTypeName,
and IParameterMetaData.getParameterType and getParameterTypeName.

These driver-specifc native data type values are mapped to one or more ODA data
types in the "odaScalarDataType" and "alternativeOdaDataType" elements in your ODA
extension plugin.xml. Please see the description of these elements in the ODA
extension point schema (in the source tree under
org.eclipse.birt.data.oda/schema/datasource.exsd ).

The data type mapping indicates to an ODA consumer that the ODA driver is capable
of converting a native data type to these corresponding ODA data types. For
example, a column's native data type code "155" and name "ItemNumber" is mapped to
the "Integer" and "String" ODA data types. When an ODA consumer retrieves value
from a column of this native data type, it can thus call either IResultSet.getInt
or getString methods to get the column value in the converted data type.
An ODA consumer application, such as BIRT, can then in turn map from the ODA data
types to the application-specific data types.

>> nativeDataType = native meaning machine representation of it? or
language rep? not sure where we get the string VARCHAR from

The native data type name is whatever your data source calls it. E.g. some RDBMS
names a string data type as "VARCHAR", which is exposed by the JDBC ODA driver.
Your ODA driver would define whatever name and code that are appropriate to your
underlying data source.

>> Can I have complex odaScalarDataType="MyHugeJavaClass" and the
classloader will find the class for this guy and load it?

As the name indicates, these are "scalar" ODA data types. So mapping to
driver-defined complex data types is not currently supported in this schema.

Hope the above clarification helps.

Linda


Mike Boyersmith wrote:

> Ok more questions, So say I have a data type that is Java String
>
> and I create the following entry in my manifest (using other examples
> for reference)
>
> <dataTypeMapping
> nativeDataType="VARCHAR"
> nativeDataTypeCode="152"
> odaScalarDataType="String"/>
>
> so this is how I read this at the moment:
>
> nativeDataTypeCode = some made up code that represents the translation
> to from NataiveDatatype to odaScalarDataType, driver assigned
>
> odaScalarDataType = something ODA knows how to map to, String, Integer,
> Boolean (A java type), My Class that class loader can find?
>
> nativeDataType = native meaning machine representation of it? or
> language rep? not sure where we get the string VARCHAR from
>
> Q: Can I have complex odaScalarDataType="MyHugeJavaClass" and the
> classloader will find the class for this guy and load it?
>
> Q: It seems that the nativeDataType possible values are hard coded
> somewhere java.sql.types? or what is the set of valid values for this?
> where are they defined? not sure I get this entry.sorry I'm thick headed
> at times. Seems birt Oda framework uses java.sql types for this?
>
> Thanks for any help here, just hard to understand this.
Previous Topic:Indenting using Style
Next Topic:Hyperlink support
Goto Forum:
  


Current Time: Sat Jul 19 05:23:31 EDT 2025

Powered by FUDForum. Page generated in 0.05969 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top