(PHP 4 >= 4.3.0, PHP 5)
pg_convert — Convert associative array values into suitable for SQL statement
pg_convert() checks and converts the values in assoc_array into suitable values for use in a SQL statement. Precondition for pg_convert() is the existence of a table table_name which has at least as many columns as assoc_array has elements. The fieldnames in table_name must match the indices in assoc_array and the corresponding datatypes must be compatible. Returns an array with the converted values on success, FALSE otherwise.
Note: If there are boolean fields in table_name don't use the constant TRUE in assoc_array . It will be converted to the string 'TRUE' which is no valid entry for boolean fields in PostgreSQL. Use one of t, true, 1, y, yes instead.
이 함수는 실험적입니다. 이 함수의 작동, 함수의 이름, 그리고 관련된 모든 문서는 이후의 PHP 릴리즈에서 예고 없이 변경할 수 있습니다. 이 함수의 사용에 관한 것은 사용자 책임입니다.
PostgreSQL database connection resource.
Name of the table against which to convert types.
Data to be converted.
Any number of PGSQL_CONV_IGNORE_DEFAULT, PGSQL_CONV_FORCE_NULL or PGSQL_CONV_IGNORE_NOT_NULL, combined.
An array of converted values, or FALSE on error.
Example #1 pg_convert() example
<?php
$dbconn = pg_connect('dbname=foo');
$tmp = array(
'author' => 'Joe Thackery',
'year' => 2005,
'title' => 'My Life, by Joe Thackery'
);
$vals = pg_convert($dbconn, 'authors', $tmp);
?>