Skip to the main content.
Downloads Thriftly Login
Downloads Thriftly Login
Group 762

Migrate and run DataFlex applications with Oracle, MS SQL Server, PostgreSQL, MySQL &  MariaDB.

flex2Crystal

Stuck in Crystal XI?  Upgrade and use the latest versions of Crystal Reports with DataFlex applications. 

BTR2SQL

Seamlessly convert from Btrieve transactional database to PostgreSQL, Oracle, and MS SQL Server.

thriftly-1

Quickly build multi-protocol web services with the same API. Supports JSON-RPC, REST, SOAP,  Thrift, and gRPC.

 Group 671-1

 

Why Mertech?

1 min read

Working with new SQL Server 2008 data types

DataFlex only supports five physical data types: NUMERIC, ASCII, DATE, TEXT and BINARY. The sixth, OVERLAP, is a logical type which maps to any one of the physical types. In the SQL world however, there are many different data types that the driver has to support. This is especially important when you are connecting to applications using the same SQL server as your DataFlex application but developed in other languages.


In Mertech's v10 and v11 drivers, we worked to ensure that we support all data types that can be mapped to a DataFlex data type. For example, in SQL 2008, new types like DATE, TIME, DATETIME2, DATETIMEOFFSET were added along with some new the Spatial Data types. So how do we map these new data types the SQL Server driver?


Let us start with the most important one DATE. Prior to SQL 2008, MS SQL Server only supported the DATETIME data type. The DataFlex Date type only contains the date part and not the year part. In order to support the dates properly in DataFlex and to ensure consistent finds, the driver would save all the dates with a time of 12:00:00:00 am. When it retrieved the data, the time part would be stripped. We did support retrieving the time part separately in a round about way.


With SQL Server 2008, Microsoft introduced a DATE which is closer to native DataFlex date type (without the time part) and Visual DataFlex introduced a DATETIME type which includes the time part. The driver handles the default mappings depending on the version of VDF and MS SQL Server you are using. The following list defines how the driver defaults are mapped for handling dates.

DATAFLEX DATA TYPE SQL 2005 DEFAULT SQL 2008 DEFAULT
DATE DATETIME DATE
DATETIME DATETIME DATETIME2

 

Other new data types (see table below) cannot be mapped directly to a DataFlex type, therefore they are Read Only and all map to DF_BINARY. Read Only means that you can read that Data in raw form into DataFlex but won't be able to write to them.

SQL 2008 DATA TYPE DATAFLEX MAPPING
TIME ASCII (read only)
DATETIMEOFFSET ASCII (read only)
HIERARCHYID BINARY (read only)
ROWVERSION BINARY (read only)
GEOMETRY BINARY (read only)
GEOGRAPHY BINARY (read only)



Why Migrate from Btrieve to PostgreSQL and other Relational Databases?

Why Migrate from Btrieve to PostgreSQL and other Relational Databases?

Introduction Many independent software vendors (ISV) and corporate users still rely on applications that use a category of database collective called...

Read More
Four Challenges in Converting COBOL Applications from ISAM Databases to Relational Databases

Four Challenges in Converting COBOL Applications from ISAM Databases to Relational Databases

COBOL applications are the foundation of numerous essential business functions, especially within the banking, insurance, and government sectors....

Read More
Application Modernization 101: Ultimate Guide to Digital Transformation

Application Modernization 101: Ultimate Guide to Digital Transformation

Imagine breaking free from the constraints of old, monolithic systems and embracing the agility and innovation of cloud-based solutions.

Read More