(PHP 4 >= 4.3.0, PHP 5, PHP 7)
pg_convert — 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷值转锟斤拷为锟绞猴拷 SQL 锟斤拷锟侥革拷式锟斤拷
$connection
, string $table_name
, array $assoc_array
[, int $options
= 0
] ) : array
pg_convert() 锟斤拷锟� assoc_array
锟叫碉拷值锟斤拷锟斤拷锟斤拷转锟斤拷为为锟斤拷锟斤拷锟斤拷 SQL 锟斤拷锟斤拷值锟斤拷pg_convert()
锟斤拷前锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟叫的憋拷 table_name
锟叫撅拷锟叫碉拷锟斤拷锟斤拷锟斤拷锟斤拷 assoc_array
锟叫的碉拷元锟斤拷么锟洁。table_name
锟叫碉拷锟街讹拷锟斤拷锟皆硷拷锟街讹拷值锟斤拷锟斤拷锟� assoc_array
锟叫的硷拷锟斤拷锟斤拷值匹锟戒。锟斤拷锟斤拷晒锟斤拷蚍祷锟揭伙拷锟斤拷锟斤拷锟阶拷锟斤拷锟斤拷值锟斤拷锟斤拷锟介,锟斤拷锟津返伙拷 FALSE
锟斤拷
Note:
If there are boolean fields in
table_name
don't use the constantTRUE
inassoc_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 锟斤拷锟斤拷锟芥本锟斤拷未通知锟酵憋拷锟睫改★拷使锟矫憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟皆碉拷 锟斤拷
connection
PostgreSQL database connection resource.
table_name
Name of the table against which to convert types.
assoc_array
Data to be converted.
options
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);
?>