The following table indicates the values of the sqllen and sqltype structure members returned by the DESCRIBE statement for the various database types (both SELECT LIST and BIND VARIABLE DESCRIBE statements). In the case of a user-defined database data type, the base type is described.

Your program can use the types and lengths returned from a DESCRIBE, or you may use another type. The database server performs type conversions between any two types. The memory pointed to by the sqldata field must correspond to the sqltype and sqllen fields. The embedded SQL type is obtained by a bitwise AND of sqltype with DT_TYPES (sqltype & DT_TYPES).

For information about embedded SQL data types, see Embedded SQL data types.

Database field type | Embedded SQL type returned | Length (in bytes) returned on describe |
---|---|---|

BIGINT | DT_BIGINT | 8 |

BINARY(n) | DT_BINARY | n |

BIT | DT_BIT | 1 |

CHAR(n) | DT_FIXCHAR | n |

DATE | DT_DATE | length of longest formatted string |

DECIMAL(p,s) | DT_DECIMAL | high byte of length field in SQLDA set to p, and low byte set to s |

DOUBLE | DT_DOUBLE | 8 |

FLOAT | DT_FLOAT | 4 |

INT | DT_INT | 4 |

LONG BINARY | DT_LONGBINARY | 32767 |

LONG NVARCHAR | DT_LONGNVARCHAR^{1} |
32767 |

LONG VARCHAR | DT_LONGVARCHAR | 32767 |

NCHAR(n) | DT_NFIXCHAR^{1} |
n times maximum character length in client's NCHAR character set |

NVARCHAR(n) | DT_NVARCHAR^{1} |
n times maximum character length in client's NCHAR character set |

REAL | DT_FLOAT | 4 |

SMALLINT | DT_SMALLINT | 2 |

TIME | DT_TIME | length of longest formatted string |

TIMESTAMP | DT_TIMESTAMP | length of longest formatted string |

TINYINT | DT_TINYINT | 1 |

UNSIGNED BIGINT | DT_UNSBIGINT | 8 |

UNSIGNED INT | DT_UNSINT | 4 |

UNSIGNED SMALLINT | DT_UNSSMALLINT | 2 |

VARCHAR(n) | DT_VARCHAR | n |

^{1} In embedded SQL, NCHAR, NVARCHAR, and LONG NVARCHAR are described as either DT_FIXCHAR, DT_VARCHAR, and DT_LONGVARCHAR, respectively,
by default. If the db_change_nchar_charset function has been called, the types are described as DT_NFIXCHAR, DT_NVARCHAR,
and DT_LONGNVARCHAR, respectively. See db_change_nchar_charset function.

Envoyer votre avis sur cette page par email. | Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |