PHP 5.6.0 released

ingres_field_type

(PHP 4 >= 4.0.2, PHP 5 <= 5.0.5, PECL ingres >= 1.0.0)

ingres_field_typeGibt den Typ eines Feldes in einer Ergebnismenge zurück

Beschreibung

string ingres_field_type ( resource $result , int $index )

Gibt den Typ eines Feldes in einer Ergebnismenge zurück.

Parameter-Liste

result

Die Ergebniskennung

index

index ist die Feldnummer und muss zwischen 1 und dem Wert liegen, den ingres_num_fields() zurückgibt.

Rückgabewerte

ingres_field_type() gibt den Typ eines Feldes in einer Ergebnismenge zurück oder FALSE, wenn ein Fehler aufgetreten ist. Beispiele von Rückgabewerten sind: IIAPI_BYTE_TYPE, IIAPI_CHA_TYPE, IIAPI_DTE_TYPE, IIAPI_FLT_TYPE, IIAPI_INT_TYPE oder IIAPI_VCH_TYPE. Einige dieser Typen können, in Abhängigkeit von der Feldlänge, mehrere SQL-Typen umfassen. (siehe ingres_field_length()). Beispielsweise kann IIAPI_FLT_TYPE entweder float4 oder float8 sein. Genauere Informationen darüber finden Sie in dem OpenAPI User Guide, Appendix "Data Types", in der Ingres-Dokumentation.

Siehe auch

add a note add a note

User Contributed Notes 3 notes

up
0
burckhardtCUTMEOUT at gsf dot de
12 years ago
I have to apologise for the previous two long postings, but information referring to the INGRES data types is a bit hard to find, so I want to share it. Below is my translation script for INGRES->MySQL data types.

<?
// Fieldtype Translator  INGRES => MySQL (c) F.Burckhardt
// translates string, int, date; might be incomplete with respect to other INGRES data-types
$sql="SELECT * FROM table";
$conn = ingres_connect ($database, $user, $password);
$results = ingres_query($sql,$conn);
$fieldtype = array ( "key" => "val");
$ingres_translation = array( "IIAPI_VCH_TYPE" => "string",
                              "IIAPI_CHA_TYPE" => "string",
                              "IIAPI_INT_TYPE" => "int",
                              "IIAPI_DTE_TYPE" => "date");
for($i=1; $i<ingres_num_fields($conn)+1; $i++) {
   $fieldtype [ingres_field_name($i,$conn)] = $ingres_translation[ingres_field_type($i,$conn)];
   echo ("field_name (".ingres_field_name($i,$conn).") field_type (INGRES): ".ingres_field_type($i,$conn)." => fieldtype (MySQL)".$ingres_translation[ingres_field_type($i,$conn)]." <br>");
        }
?>
up
0
burckhardtCUTMEOUT at gsf dot de
12 years ago
IIAPI_LOGKEY_TYPE A data type with values that are unique within the data source. An application should not attempt to update a column containing a system-maintained object key.

IIAPI_LBYTE_TYPE A variable-length binary string. The actual length of the large byte segment is stored in the first two bytes of the data buffer, followed by the large byte data. Length: 0 to 2,000,000,000 characters.

IIAPI_LVCH_TYPE A variable-length character string. The actual length of the large varchar segment is stored in the first two bytes of the data buffer, followed by the large varchar data. Valid characters for this data type include printing, non-printing, and NULL characters. Trailing blanks are insignificant in a varchar data type. Length: 0 to 2,000,000,000 characters.

IIAPI_MNY_TYPE The Ingres money data type stored in 8 bytes with 2 fixed decimal places.  IIAPI_convertData() or  IIAPI_formatData() can be used to convert to character string or floating point representation.

IIAPI_TABKEY_TYPE A data type with a value that is unique within the table where the table key is stored. An application should not attempt to update a column containing a systemmaintained table key.

IIAPI_TXT_TYPE A variable-length character string. The maximum size for this data type is stored as the ds_length parameter in the corresponding descriptor. The actual length of the text data is stored in the first two bytes of the data buffer, followed by the text data. Valid characters for this data type include printing and non-printing characters. All blanks are significant in a text data buffer. This type is supported for previous Ingres versions; when possible, use  IIAPI_VCH_TYPE. Length: 1 to 2,000 characters.

IIAPI_VBYTE_TYPE A variable-length binary string. The maximum size for varbyte data is stored as the ds_length parameter in the corresponding descriptor. The actual length of the varbyte data is stored in the first two bytes of the data buffer, followed by the varbyte data. Length: 0 to 2,000 characters.

IIAPI_VCH_TYPE A variable-length character string. The maximum size for varchar data is stored as the ds_length parameter in the corresponding descriptor. The actual length of the varchar data is stored in the first two bytes of the data buffer, followed by the varchar data. Trailing blanks are insignificant in a varchar data type. Length: 0 to 2,000 characters.
up
0
burckhardtCUTMEOUT at gsf dot de
12 years ago
Ingres Data Types (oapi.pdf open api user guide)
Data Type Descriptions Ingres data types are described in the following table:
Data Type Description
IIAPI_BYTE_TYPE A fixed length binary string containing data with the declared length. The declared length is stored as the ds_length parameter in the corresponding data descriptor. Length: 1 to 2,000 characters.

IIAPI_CHA_TYPE A fixed length character string that is stored blankpadded to the declared length. The declared length is stored as the ds_length parameter in the corresponding data descriptor. Embedded blanks are significant. Valid characters for this data type include printing, nonprinting, and NULL characters. Length: 1 to 2,000 characters.

IIAPI_CHR_TYPE A fixed length character string that is stored blankpadded to the declared length. The declared length is stored as the ds_length parameter in the corresponding data descriptor. Embedded blanks are insignificant. Valid characters for this data type include printing characters only. This data type is supported for previous Ingres versions; when possible, use IIAPI_CHA_TYPE. Length: 1 to 2,000 characters.

IIAPI_HNDL_TYPE A data type used only by OpenAPI and the application. This data type describes a handle, which is a pointer to one of the control blocks created by OpenAPI. OpenAPI translates the information in the control block into data acceptable by the data source. This data type does not appear in queries.

IIAPI_DEC_TYPE A packed decimal data type stored in 1 to 16 bytes depending on the precision of the value as follows: len = (precision)/2 + 1. IIAPI_convertData() or  IIAPI_formatData() may be used to convert to character string or floating point representation.

IIAPI_DTE_TYPE Ingres internal date data type that is stored in 12 bytes. IIAPI_convertData() or IIAPI_formatData() may be used to convert to character string or floating point representation.

IIAPI_FLT_TYPE A data type supporting data value ranges from - 1.0e+38 to +1.0e+38.

IIAPI_INT_TYPE A data type supporting varying data value ranges. It is dependent on the ds_length of the data value. If the length is 1, the range is from -128 to +127. If the length is 2, the range is from -32,768 to +32,767. If the length is 4, the range is from -2,147,483,648 to +2,147,483,647.
To Top