Inspekt\Inspekt::escPgSQL PHP Method

escPgSQL() public static method

If the data is for a column of the type bytea, use Inspekt::escPgSQLBytea()
public static escPgSQL ( mixed $value, resource $conn = null ) : mixed
$value mixed
$conn resource the postgresql connection. If none is given, it will use the last link opened, per behavior of pg_escape_string
return mixed
    public static function escPgSQL($value, $conn = null)
    {
        if (Inspekt::isArrayOrArrayObject($value)) {
            return Inspekt::walkArray($value, 'escPgSQL');
        } else {
            //might also check is_resource if pg_connection_status is too much
            if (isset($conn) && pg_connection_status($conn) === PGSQL_CONNECTION_OK) {
                return pg_escape_string($conn, $value);
            } else {
                return pg_escape_string($value);
            }
        }
    }