Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Wenn eine Anwendung die Daten aus der Datenquelle abruft SQLFetch, SQLFetchScrolloder SQLGetDataruft der Treiber die Daten ab. If necessary, it converts the data from the data type in which the driver retrieved it to the data type specified by the TargetType argument in SQLBindCol or SQLGetData. Finally, it stores the data in the location pointed to by the TargetValuePtr argument in SQLBindCol or SQLGetData (and the SQL_DESC_DATA_PTR field of the ARD).
Die folgende Tabelle zeigt die unterstützten Konvertierungen von ODBC SQL-Datentypen in ODBC-C-Datentypen. A filled circle indicates the default conversion for a SQL data type (the C data type to which the data will be converted when the value of TargetType is SQL_C_DEFAULT). Ein hohler Kreis gibt eine unterstützte Konvertierung an.
For an ODBC 3.x application working with an ODBC 2.x driver, conversion from driver-specific data types might not be supported.
Das Format der konvertierten Daten ist von der Windows-Länder-/Regionseinstellung nicht betroffen.
In den Tabellen in den folgenden Abschnitten wird beschrieben, wie der Treiber oder die Datenquelle Daten konvertiert, die aus der Datenquelle abgerufen wurden. Treiber sind erforderlich, um Konvertierungen in alle ODBC-C-Datentypen aus den von ihnen unterstützten ODBC-SQL-Datentypen zu unterstützen. For a given ODBC SQL data type, the first column of the table lists the legal input values of the TargetType argument in SQLBindCol and SQLGetData. The second column lists the outcomes of a test, often using the BufferLength argument specified in SQLBindCol or SQLGetData, which the driver performs to determine whether it can convert the data. For each outcome, the third and fourth columns list the values placed in the buffers specified by the TargetValuePtr and StrLen_or_IndPtr arguments specified in SQLBindCol or SQLGetData after the driver has attempted to convert the data. (The StrLen_or_IndPtr argument corresponds to the SQL_DESC_OCTET_LENGTH_PTR field of the ARD.) The last column lists the SQLSTATE returned for each outcome by SQLFetch, SQLFetchScroll, or SQLGetData.
If the TargetType argument in SQLBindCol or SQLGetData contains an identifier for an ODBC C data type not shown in the table for a given ODBC SQL data type, SQLFetch, SQLFetchScroll, or SQLGetData returns SQLSTATE 07006 (Restricted data type attribute violation). If the TargetType argument contains an identifier that specifies a conversion from a driver-specific SQL data type to an ODBC C data type and this conversion isn't supported by the driver, SQLFetch, SQLFetchScroll, or SQLGetData returns SQLSTATE HYC00 (Optional feature not implemented).
Although it's not shown in the tables, the driver returns SQL_NULL_DATA in the buffer specified by the StrLen_or_IndPtr argument when the SQL data value is NULL. For an explanation of the use of StrLen_or_IndPtr when multiple calls are made to retrieve data, see the SQLGetData Function function description. When SQL data is converted to character C data, the character count returned in StrLen_or_IndPtr doesn't include the null-termination byte. If TargetValuePtr is a null pointer, SQLGetData returns SQLSTATE HY009 (Invalid use of null pointer); in SQLBindCol, this unbinds the column.
Die folgenden Begriffe und Konventionen werden in den Tabellen verwendet:
Die Bytelänge der Daten ist die Anzahl der Bytes von C-Daten, die in TargetValuePtr zurückgegeben werden können, unabhängig davon, ob die Daten abgeschnitten werden, bevor sie an die Anwendung zurückgegeben werden. Bei Zeichenfolgendaten enthält dies nicht das Leerzeichen für das Nullendpunkt.
Die Zeichenbytelänge ist die Gesamtanzahl der Bytes, die zum Anzeigen der Daten im Zeichenformat erforderlich sind. This is as defined for each C data type in the section Display Size, except that character byte length is in bytes while the display size is in characters.
Words in italics represent function arguments or elements of the SQL grammar. Die Syntax von Grammatikelementen finden Sie in Anhang C: SQL Grammar.
Dieser Abschnitt enthält die folgenden Artikel.
- SQL to C: Character (SQL zu C: Zeichen)
- SQL to C: Numeric (SQL zu C: Numerisch)
- SQL to C: Bit (SQL zu C: Bit)
- SQL to C: Binary (SQL zu C: Binär)
- SQL to C: Date (SQL zu C: Datum)
- SQL to C: GUID (SQL zu C: GUID)
- SQL to C: Time (SQL zu C: Zeit)
- SQL to C: Timestamp (SQL zu C: Zeitstempel)
- SQL to C: Year-Month Intervals (SQL zu C: Jahr-Monat-Intervalle)
- SQL to C: Day-Time Intervals (SQL zu C: Taginvervalle)
- SQL to C Data Conversion Examples (Beispiele für die Datenkonvertierung von SQL zu C)