SQL::DataTypeInfo Class
Description
Properties and methods in the DataTypeInfo Class.
Discussion
The SQL::DataTypeInfo object description describes a column in a SQL::ResultSet or an element in a SQL::Row. The object includes the name, size, precision, Alpha Anywhere type, the native type, and an intermediate type (see SQL::IntermediateType below) which contains more precise type information. This intermediate type makes it possible to recreate a table using the closest possible matching type in the target table.
- Name
- Description
- NamedFormatExpression Example
The SQL::DataTypeInfo.NamedFormatExpression property is a CR-LF delimited list of expressions in the following format:
Example
The following script retrieves data into a SQL::ResultSet, extracts a SQL::Row with SQL::ResultSet.NextRow(), then lists the properties of one of the row's SQL::DataTypeInfo objects.
dim conn as SQL::Connection dim rs as SQL::ResultSet dim cr as SQL::Row dim dti as SQL::DataTypeInfo dim connString as C dim select_exp as C connString = "{A5API='Access', FileName='c:\program files\a5v8\mdbfiles\alphasports.mdb'}" select_exp = "select Lastname from customer where bill_state_region = 'ma'" if .not. conn.open(connString) ui_msg_box("Error", conn.CallResult.text) end end if if .not. conn.execute(select_exp) ui_msg_box("Error", conn.CallResult.text) conn.close() end end if rs = conn.ResultSet rs.NextRow() cr = rs.CurrentRow dti = cr.ColumnInfo[1] ui_msg_box("Data Type Info", dti.xml) conn.close()
This example in the Interactive Window shows the use of the .HTMLEscapeFormattedData property.
dim c as SQL::connection dim ti as SQL::tableinfo c.open("{a5api=access,filename=c:\northwind.mdb}") c.execute("select * from categories") ti = c.resultset. ToTableInfo() ti.column3.HTMLEscapeFormattedData = .t. c.ToJSON("select * from categories", -1, 1, ti)
Properties
- XMLCharacter
The schema in XML format.
- NameCharacter
Default = "". The unique name of the column within the table.
- NativeAPICharacter
Default = "". The name of the API used (ODBC, MySQL, ADO, etc.).
- NativeSyntaxCharacter
Default = "". The name of the syntax used to interact with the database (usually the name of the vendor or database type).
- CommentCharacter
Default = "". The comment stored for the column, if the database supports it.
- AlphaTypeCharacter
Default = "". The type of the column as specified with Xbasic.
- AlphaTypeNameCharacter
Default = "Invalid". A printable description of the AlphaType.
- NativeTypeNumeric
Default = 0. A database specific type which uniquely describes the data.
- NativeTypeNameCharacter
Default = "". A printable description of the .NativeType.
- IntermediateTypeSQL::IntermediateType
Default = -1. A product independent type definition.
- IntermediateTypeNameCharacter
Default = "Invalid". A printable description of the .IntermediateType.
- DecimalDigitsNumeric
Default = 0. For numbers only. This is the number of digits to the right of the decimal point.
- DisplayFormatCharacter
Default = "". Currently for numeric fields only, this value is used when calling FormatData on a SQL::ResultSet, SQL::Row, or SQL::DataTypeInfo.The formatting has the same effect as calling str()using the numeric value of the column and the properties DBFLength and DBFDecimals.
- ExternalFileNameExpressionCharacter
Default = "". An Xbasic expression to be used in formatting a filename to persist the column data to. When FormatData is called, the current value of this column is written to the file name that results from evaluating this expression.
- DataTransformExpressionCharacter
Default = "". An Xbasic expression to be evaluated when retrieving data values from a SQL::ResultSet or a SQL::Row. The data is transformed each time the column is referenced using the Data function.
- LengthNumeric
Default = 0. The size of the field. For strings and blobs, this is the number of characters and bytes respectively. For numbers this is the total number of digits.
- NullableLogical
True (.T.) if the column can be Null.
- ZeroFillLogical
Default = FALSE (.F). Indicates if the field should initially be filled with zeroes.
- AutoIncrementLogical
Default = FALSE (.F).
- EmptyStringIsNullLogical
Default = FALSE (.F). Set to TRUE if an empty string should be sent to the database as NULL.
- UpdateableLogical
Default = TRUE (.T). True (.T.) if this column is updatable.
- HTMLEscapeFormattedDataLogical
Default = FALSE (.F). If this property is set to true, the contents of the column will be formatted with *HTML_ESCAPE() before being returned to the caller.
- IdentityLogical
Default = FALSE (.F). The identity column.
- IdentitySeedNumeric
Default = 0. The initial value of a the set of identities.
- IdentityIncrementNumeric
Default = 0. The value to increment the identity prior to insert.
- IdentityReplicateLogical
Default = TRUE (.T). Whether to copy this identity when doing replication to another table.
- IdentityMinimumNumeric
IdentityMinimum property
- IdentityMaximumNumeric
IdentityMaximum property
- IdentitySequenceNameCharacter
Default = "". This property applies to Oracle (and probably DB2 ) and is necessary to generate the correct SQL.
- NamedFormatExpressionsCharacter
Default = "". This property is a CR-LF delimited list of expressions, where each line is made up of a name followed by an equal sign and the Xbasic expression to execute. The Xbasic Expression is used to format the data when the named format is requested. The expression executes in a context that has the following predefined variables: CurrentRow as SQL::Row, ColumnDefinition as SQL::DataTypeInfo, Context as P. For example: Short=Left(CurrentRow.Data("Description")) Long=CurrentRow.Data("A")
- DefaultValueCharacter
Default = "". The initial value to be assigned.
- DefaultValueNameCharacter
Default = "". The name of the rule (constraint).
- SourceTypeNumeric
Default = 0.
- DBFNameCharacter
Default = "". The name of the column with any reformatting required to make it a valid DBF column name.
- DBFTypeCharacter
Default = "". The column type to be used in specifying an Alpha Anywhere .DBF.
- DBFLengthNumeric
Default = 0. The length required for a column specification. See .SizeToFit.
- DBFDecimalsNumeric
Default = 0. The number of decimal places to be used in specifying an Alpha Anywhere .DBF.
- DBFColumnSyntaxCharacter
The complete syntax to be used in specifying the column for an Alpha Anywhere .DBF.
- SourceTableCatalogCharacter
SourceTableCatalog property
- SourceTableSchemaCharacter
SourceTableSchema property
- SourceTableOwnerCharacter
Default = "". The owner of the table (not always available).
- SourceTableNameCharacter
Default = "". The table name (not always available).
- SourceColumnNameCharacter
Default = "". The column name in the table (not always available).
- SourceTableAliasCharacter
SourceTableAlias property
- FixedLengthLogical
Default = FALSE (.F). The column is fixed length.
- ValidationTextCharacter
Default = "". The message to display.
- NativeValidationRuleCharacter
Default = "". An expression describing the rule for validation in native syntax.
- NativeValidationRuleNameCharacter
Default = "". The name of the validation rule.
- NativeCharacterSetNameCharacter
String NativeCharacterSetName property
- AutoGenerateLogical
Default = FALSE (.F).
- ISAMNotLastColumnLogical
Default = FALSE (.F). Jet Driver Specific
- OneBlobPerPageLogical
Default = FALSE (.F). Jet Driver Specific
- CompressedUnicodeLogical
Default = FALSE (.F). Data is stored on native platform as compressed Unicode strings.
- HyperLinkLogical
Default = FALSE (.F). Hyperlink string.
- CanBeUsedInWhereClauseLogical
Default = TRUE (.T). If TRUE, the column can be used in a WHERE clause. Some binary and long text columns are not permitted to be used in a where clause for some databases.
- SQLExpressionCharacter
Default = "".
- SizeToFitLogical
Default = FALSE (.F). When set to true, .DBFColumnSyntax and .DBFLength properties will return lengths adjusted based on the actual data. Notes:
Call UpdateStatistics()before getting the .DBFRowSyntax.
If the longest column is zero length, the default length is 15.
Size to fit will limit the size of inserted or updated fields on imported or linked tables to the maximum size of the previous values.
- MaximumActualLengthNumeric
Default = -1. Set by UpdateStatistics(). This value is the maximum actual length of character and binary columns. Otherwise it is set to zero.
- ComputedLogical
Computed property
- RowUUIDLogical
RowUUID property
Methods
- Clone Method
Creates a copy of an object instance.
- FormatData Method
Return data values defined by this SQL::DataTypeInfo
See Also