php man page for pg_escape_literal

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 field

SYNOPSIS
string pg_escape_literal ([resource $connection], string $data)
DESCRIPTION
pg_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.
PARAMETERS
o $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 VALUES
A string containing the escaped data.
EXAMPLES
Example #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 ALSO
pg_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_escape_bytea(3) - php
pg_lo_create(3) - php
pg_query(3) - php
pg_send_query(3) - php
Similar Topics in the Unix Linux Community
How to insert data into MYSql database from a text file
awk: Force &quot;escaped&quot; representation of a field
ext File
Using read with escaped variables
Handling embedded double quotes within column data