Data types
<< Click to Display Table of Contents >> Data types |
![]() ![]() ![]() |
Some of the Data Types that are available in Ado/Visual Basic are not available in Visual Objects. We have tried to overcome this by adding a few classes to Vo2Ado and special syntaxes to Vo2Ado.
Data type |
VO equivalent |
DateTime |
AdoDateTime or DATE |
Null |
NIL or #Null |
Empty |
NIL or #empty |
Chapter |
AdoRecordSet |
Currency |
Float |
Decimal |
Float |
Image |
AdoLongBinary |
Strings |
String |
DateTime
DateTime values can be returned from some of the access of Ado objects, such as the DateModified access on the AdoTable class. It can also be returned as the value of a field of the data type AdDate or similar. In Ado this is represented in a DateTime value, but VO doesn't have such a datatype.Vo2Ado can return these values in an object of AdoDateTime or in a Date value. The format is determined by the setting of the AdoDateTimeAsDate() function. By default this setting is false, and AdoDateTime values are returned. When you set AdoDateTimeAsDate() to TRUE DateTime values are returned as VO Date values, without the time part of the value.
Null values
Columns containing NULL values will return a NIL value by default. You can also set a column to NULL by assiging a NIL to the column. As an alternative for the NIL value you may also use the #Null symbol.
When you are using the AdoServer class (or one of its subclasses) you can use the NullAsBlank property to force Vo2Ado to return blank values of the proper datatype in stead of NIL values .
Empty values
When you are skipping an array element in Ado/VB the contents of this element is filled with as so-called Empty value. When reading this kind of array elements the VO translation will be NIL. When writing an array (like in the aRestrictions array of the AdoConnection:OpenSchema method) you can store the #Empty symbol in the array. This will be replaced with the Ado/VB Empty value by Vo2Ado. All NIL values in arrays will be replaced with Empty by Vo2Ado as well.
Chapter columns
So called 'shaped recordsets' return a sub-recordset in the so-called chapter columns. These sub-recordsets are regular AdoRecordSets.
When you are reading Chapter columns at the AdoRecordSet level you will receive an object of AdoObject. You must convert this to an AdoRecordSet yourself by creating an AdoRecordSet object and by passing the AdoObject as an argument to the AdoRecordSet class.
When you are using the AdoServer class to read chapter columns this translation from an AdoObject into an AdoRecordSet object is done automatically by the AdoServer:FieldGet() method.
When you are using the AdoShapeServer class the AdoRecordSet returned by the AdoServer:FieldGet() is returned as an AdoShapeServer object by the SetRelation method.
Currency and Decimal
These two numeric types are both translated by Vo2Ado to the FLOAT datatype of VO. During this conversion some precision may be lost, but what is the alternative ?
Images
Image are returned in AdoLongBinary objects. See the next chapter Binary values for more information.
Strings
We translate all kind of ADO strings into VO strings and back. Please be careful when assigning VO strings to Ado strings not to exceed the maximum length. This may cause a runtime error.
The AdoServer:FieldPut() method truncates strings to the maximum field length, to solve this problem, but when you are using the AdoRecordSet:Collect access/assigns or the Field:Value or Parameter:Value there is no built in check for the string length. We assume you know what you are doing . There are also 2 runtime functions that determine the way NULL_STRINGS are converted to COM: AdoCheckNullString and AdoConvertNullStringToNull
The following table shows the effect of these methods:
AdoCheckNullString=TRUE |
AdoCheckNullString=FALSE |
|
AdoConvertNullStringToNull=TRUE |
#Null |
NULL_STRING |
AdoConvertNullStringToNull=FALSE |
#Empty = Default |
NULL_STRING |
AdoDateTime, AdoLongBinary, AdoDateTimeAsDate(), AdoServer:NullAsBlank, AdoRecordSet, AdoServer, AdoServer:FieldGet(), AdoServer:FieldPut(), AdoShapeServer, AdoShapeServer:SetRelation(), AdoCheckNullString, AdoConvertNullStringToNull