libpq library

From: "Familia Cerezo" <cerezo(at)wanadoo(dot)es>
To: <maillist(at)candle(dot)pha(dot)pa(dot)us>
Subject: libpq library
Date: 2000-01-22 12:16:04
Message-ID: 000501bf64eb$56f433c0$733d243e@es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Estimated sirs:

I am a Computers Engineering student. Currently I am doing a program in C which uses the PostgreSQL's library "libpq" and I have a problem:

I can't introduce in the data base a simple quote. For example:

char *sent_sql;
char *dato;
strcpy(dato, "grocery's");
sprintf(sent_sql, "insert into table values ('%s')", dato);

However, I don't have problems with the SQL interpreter, eg.:
insert into table values ('grocery\'s');
In this case, the data will be stored as "grocery's" (OK!), but I don't find the way I could do that using the library.

I just can't introduce the '\' character previous to the simple quote because I will loose the final character of the string. I can't define the field as type text because I need that the field had a defined size (I got to store encrypted data).

If you know a solution, I would thank you.

Sorry for my english and thanks for paying attention to this e-mail,

DAVID.

Browse pgsql-general by date

  From Date Subject
Next Message Peter Mount 2000-01-22 14:44:28 Re: [GENERAL] jdbc connect in StarOffice
Previous Message Adriaan Joubert 2000-01-22 08:28:43 Re: [GENERAL] implementing a psql daemon