Query: pg_escape_literal
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
PG_ESCAPE_LITERAL(3) PG_ESCAPE_LITERAL(3) pg_escape_literal - Escape a literal for insertion into a text fieldSYNOPSISstring pg_escape_literal ([resource $connection], string $data)DESCRIPTIONpg_escape_literal(3) escapes a literal for querying the PostgreSQL database. It returns an escaped literal in the PostgreSQL format. pg_escape_literal(3) adds quotes before and after data. Users should not add quotes. Use of this function is recommended instead of pg_escape_string(3). If the type of the column is bytea, pg_escape_bytea(3) must be used instead. For escaping identifiers (e.g. table, field names), pg_escape_identifier(3) must be used. Note This function has internal escape code and can also be used with PostgreSQL 8.4 or less.PARAMETERSo $connection - PostgreSQL database connection resource. When $connection is not present, the default connection is used. The default connection is the last connection made by pg_connect(3) or pg_pconnect(3). o $data - A string containing text to be escaped.RETURN VALUESA string containing the escaped data.EXAMPLESExample #1 pg_escape_literal(3) example <?php // Connect to the database $dbconn = pg_connect('dbname=foo'); // Read in a text file (containing apostrophes and backslashes) $data = file_get_contents('letter.txt'); // Escape the text data $escaped = pg_escape_literal($data); // Insert it into the database. Note that no quotes around {$escaped} pg_query("INSERT INTO correspondence (name, data) VALUES ('My letter', {$escaped})"); ?>SEE ALSOpg_escape_identifier(3), pg_escape_bytea(3), pg_escape_string(3). PHP Documentation Group PG_ESCAPE_LITERAL(3)
Related Man Pages |
---|
pg_last_notice(3) - php |
pg_connect(3) - php |
pg_pconnect(3) - php |
pg_send_query(3) - php |
pg_set_client_encoding(3) - php |
Similar Topics in the Unix Linux Community |
---|
[PHP] asking how to make plain text database searching system |
awk: Force "escaped" representation of a field |
ext File |
Handling embedded double quotes within column data |
Grep Help |