pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ERROR: unterminated quoted string... help
5+ messages / 4 participants
[nested] [flat]

* ERROR: unterminated quoted string... help
@ 2005-05-17 18:15 Postgres Admin <postgres@productivitymedia.com>
  2005-05-17 18:27 ` Re: ERROR: unterminated quoted string... help Scott Marlowe <smarlowe@g2switchworks.com>
  2005-05-17 19:17 ` Re: ERROR: unterminated quoted string... help Mariusz <skoot@qi.pl>
  2005-05-18 08:35 ` Re: ERROR: unterminated quoted string... help Volkan YAZICI <volkan.yazici@gmail.com>
  0 siblings, 3 replies; 5+ messages in thread

From: Postgres Admin @ 2005-05-17 18:15 UTC (permalink / raw)
  To: pgsql-php@postgresql.org; +Cc: pgsql-sql

Hi

I'm trying to insert encrypted data into the database and I'm noticing 
error dealing with quotes. Below is the error print out...

suggestions and/or at least point me in the direction to find a solution,

Thanks,
J



INSERT INTO sample.users (user_name, first_name) VALUES 
('jokers', '=ïµiF!¶6(֟㍾óˆÌ‘'-Iw‰iDÖiJÐÿ† %')

Warning: pg_query() [function.pg-query]: Query failed: ERROR: 
unterminated quoted string at or near "'=ïµi" at character 68 in 
/usr/local/apache2/htdocs/php/5/Theirry_DB.php on line 162



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: ERROR: unterminated quoted string... help
  2005-05-17 18:15 ERROR: unterminated quoted string... help Postgres Admin <postgres@productivitymedia.com>
@ 2005-05-17 18:27 ` Scott Marlowe <smarlowe@g2switchworks.com>
  2005-05-17 18:33   ` Re: [SQL] ERROR: unterminated quoted string... help Postgres Admin <postgres@productivitymedia.com>
  2 siblings, 1 reply; 5+ messages in thread

From: Scott Marlowe @ 2005-05-17 18:27 UTC (permalink / raw)
  To: Postgres Admin <postgres@productivitymedia.com>; +Cc: pgsql-sql

On Tue, 2005-05-17 at 13:15, Postgres Admin wrote:
> Hi
> 
> I'm trying to insert encrypted data into the database and I'm noticing 
> error dealing with quotes. Below is the error print out...
> 
> suggestions and/or at least point me in the direction to find a solution,
> 
> Thanks,
> J
> 
> 
> 
> INSERT INTO sample.users (user_name, first_name) VALUES 
> ('jokers', '=ïµiF!¶6(ÖŸã¾óˆÌ‘'-Iw‰iDÖiJÐÿ† %')
> 
> Warning: pg_query() [function.pg-query]: Query failed: ERROR: 
> unterminated quoted string at or near "'=ïµi" at character 68 in 
> /usr/local/apache2/htdocs/php/5/Theirry_DB.php on line 162

Use a bytea field and use pg_escape_bytea() to prepare the data for
insertion.



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [SQL] ERROR: unterminated quoted string... help
  2005-05-17 18:15 ERROR: unterminated quoted string... help Postgres Admin <postgres@productivitymedia.com>
  2005-05-17 18:27 ` Re: ERROR: unterminated quoted string... help Scott Marlowe <smarlowe@g2switchworks.com>
@ 2005-05-17 18:33   ` Postgres Admin <postgres@productivitymedia.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Postgres Admin @ 2005-05-17 18:33 UTC (permalink / raw)
  To: Scott Marlowe <smarlowe@g2switchworks.com>; +Cc: pgsql-sql

Scott Marlowe wrote:

>
>Use a bytea field and use pg_escape_bytea() to prepare the data for
>insertion.
>
>  
>
Thanks Scott, I will try it now.

J



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: ERROR: unterminated quoted string... help
  2005-05-17 18:15 ERROR: unterminated quoted string... help Postgres Admin <postgres@productivitymedia.com>
@ 2005-05-17 19:17 ` Mariusz <skoot@qi.pl>
  2 siblings, 0 replies; 5+ messages in thread

From: Mariusz Pękala @ 2005-05-17 19:17 UTC (permalink / raw)
  To: pgsql-php@postgresql.org

On 2005-05-17 14:15:53 -0400 (Tue, May), Postgres Admin wrote:
> Hi
> 
> I'm trying to insert encrypted data into the database and I'm noticing 
> error dealing with quotes. Below is the error print out...
> 
> suggestions and/or at least point me in the direction to find a solution,
> 
> Thanks,
> J
> 
> INSERT INTO sample.users (user_name, first_name) VALUES 
> ('jokers', '=??iF!?6(Ö????ó???'-Iw?iDÖiJ??? %')
> 
> Warning: pg_query() [function.pg-query]: Query failed: ERROR: 
> unterminated quoted string at or near "'=??i" at character 68 in 
> /usr/local/apache2/htdocs/php/5/Theirry_DB.php on line 162

You should pass the encrypted data thru pg_escape_string() function.
You surely should do it with almost EVERY string that you put as an
argument in a query, especially if it comes from 'outside'.

$query = "INSERT INTO .... ('jokers','" .  pg_escape_string($encrypted) . "');" ;

--
bashian roulette: 
 $ ((RANDOM%6)) || rm -rf ~



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: ERROR: unterminated quoted string... help
  2005-05-17 18:15 ERROR: unterminated quoted string... help Postgres Admin <postgres@productivitymedia.com>
@ 2005-05-18 08:35 ` Volkan YAZICI <volkan.yazici@gmail.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Volkan YAZICI @ 2005-05-18 08:35 UTC (permalink / raw)
  To: pgsql-php@postgresql.org

Hi,

On 5/17/05, Postgres Admin <postgres@productivitymedia.com> wrote:
> I'm trying to insert encrypted data into the database and I'm noticing
> error dealing with quotes. Below is the error print out...
>
> suggestions and/or at least point me in the direction to find a solution,
>
> INSERT INTO sample.users (user_name, first_name) VALUES
> ('jokers', '=ïµiF!¶6(֟㍾óˆÌ''-Iw‰iDÖiJÐÿ† %')
If you don't use parameters, you need to escape the data to place in
an SQL query command. But this may cost so much on the CPU and RAM
side if your will be escaped data is enough long to exhaust other
processes. (For example, it's not so feasible to unescape a media file
while inserting.)

At the moment, current stable releases of PHP doesn't support
parameter usage, but it was committed to CVS in revision 1.315. If
you'll need these kind of escape functions so much, I'd encourage you
to patch your php/ext/pgsql/pgsql.c with the one in CVS tree. After
patch, you'll be able to use pg_query_params, pg_prepare, pg_execute,
pg_send_query_params and pg_send_prepare; namely, every possible
parameter supported function.

Regards.


^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2005-05-18 08:35 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-05-17 18:15 ERROR: unterminated quoted string... help Postgres Admin <postgres@productivitymedia.com>
2005-05-17 18:27 ` Scott Marlowe <smarlowe@g2switchworks.com>
2005-05-17 18:33   ` Postgres Admin <postgres@productivitymedia.com>
2005-05-17 19:17 ` Mariusz <skoot@qi.pl>
2005-05-18 08:35 ` Volkan YAZICI <volkan.yazici@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox