odbc_field_type

(PHP 4, PHP 5, PHP 7, PHP 8)

odbc_field_typeDatatype of a field

说明

odbc_field_type ( resource $statement , int $field ) : string|false

Gets the SQL type of the field referenced by number in the given result identifier.

参数

statement

The result identifier.

field

The field number. Field numbering starts at 1.

返回值

Returns the field type as a string, or false on error.

User Contributed Notes

ted at convey dot de 15-Sep-2015 11:05
odbc_field_type seems to return the data type of the database backend, not the data types from ODBC documentation.

Example: With my Oracle backend I get data types like "CLOB" and "VARCHAR2" while ODBC only knows SQL_LONGVARCHAR for long character data...
jschwartz at the-infoshop dot com 04-Aug-2009 01:40
Quick note: as noted below, MS Access type AutoNumber comes across as type COUNTER. What I didn't see mentioned is that PHP interprets type COUNTER as a string, not an integer.

More annoying than anything else, in my particular case; but I'd guess it could bite somebody, somewhere.
jorge dot emailNOSPAM at gmail dot com 17-Jan-2007 04:21
Here is the complete list!

Access 2003 as the following teturntypes:

COUNTER  -  Autoincrement
VARCHAR  -  Text
LONGCHAR  -  Memo
INTEGER  -  Number
DATETIME  -  Date/Time
CURRENCY  -  Currency
BIT  -  TRUE/FALSE
LONGBINARY  -  OLE-Object
LONGCHAR  -  Hyperlink
DOUBLE - Double Number
BYTE - Byte Number
not[at]wgpower[dot]net 19-May-2006 05:02
Some fields can be of the following type too : REAL
jazper at lycos dot de 10-Jul-2002 03:30
Returntypes on Access2000
COUNTER  -  Autoincrement
VARCHAR  -  Text
LONGCHAR  -  Memo
INTEGER  -  Number
DATETIME  -  Date/Time
CURRENCY  -  Currency
BIT  -  TRUE/FALSE
LONGBINARY  -  OLE-Object
LONGCHAR  -  Hyperlink

cheers, j.a.z.
PHP8中文手册 站长在线 整理 版权归PHP文档组所有