ingres_set_environment

(PECL ingres >= 1.2.0)

ingres_set_environment — Set environment features controlling output options


Описание

bool ingres_set_environment ( resource $link , array $options )

ingres_set_environment() is called to set environmental options that affect the output of certain values from Ingres, such as the timezone, date format, decimal character separator, and float precision.


Список параметров

link -

The connection link identifier

options -

An enumerated array of option name/value pairs. The following table lists the option name and the expected type

Option name Option type Description Example
date_century_boundaryintegerThe threshold by which a 2-digit year is determined to be in the current century or in the next century. Equivalent to II_DATE_CENTURY_BOUNDARY50
timezonestringControls the timezone of the session. If not set, it will default the value defined by II_TIMEZONE_NAME. If II_TIMEZONE_NAME is not defined, NA-PACIFIC (GMT-8 with Daylight Savings) is used.UNITED-KINGDOM
date_formatinteger

Sets the allowable input and output format for Ingres dates. Defaults to the value defined by II_DATE_FORMAT. If II_DATE_FORMAT is not set, the default date format is US, for example mm/dd/yy. Valid values for date_format are:

  • INGRES_DATE_DMY
  • INGRES_DATE_FINISH
  • INGRES_DATE_GERMAN
  • INGRES_DATE_ISO
  • INGRES_DATE_ISO4
  • INGRES_DATE_MDY
  • INGRES_DATE_MULTINATIONAL
  • INGRES_DATE_MULTINATIONAL4
  • INGRES_DATE_YMD
  • INGRES_DATE_US

INGRES_DATE_ISO4
decimal_separatorstringThe character identifier for decimal data","
money_lortinteger

Leading or trailing currency sign. Valid values for money_lort are:

  • INGRES_MONEY_LEADING
  • INGRES_MONEY_TRAILING

INGRES_MONEY_LEADING
money_signstringThe currency symbol to be used with the MONEY datatype
money_precisionintegerThe precision of the MONEY datatype2
float4_precisionintegerPrecision of the FLOAT4 datatype10
float8_precisionintegerPrecision of the FLOAT8 data10
blob_segment_lengthintegerThe amount of data in bytes to fetch at a time when retrieving BLOB or CLOB data. Defaults to 4096 bytes when not set explicitly8192


Возвращаемые значения

Возвращает TRUE в случае успешного завершения или FALSE в случае возникновения ошибки.


Примеры

Пример #1 Set date_format to ISO4
$options = array( "date_format" => INGRES_DATE_ISO4 );
if (ingres_set_environment($link, $options))
{
    $result=ingres_query($link,"select date('now') as date");
    while ( $object = ingres_fetch_object ($result) ) {
        echo $object->date."\n";
    }
}

Пример #2 Set timezone to HONG-KONG
$options = array( "timezone" => "HONG-KONG");
if (ingres_set_environment($link, $options))
{
    $result=ingres_query($link,"select date('now') as date");
    while ( $object = ingres_fetch_object ($result) ) {
        echo $object->date."\n";
    }
}


Смотрите также


Описание на ru2.php.net
Описание на php.ru