libpq library - Mailing list pgsql-general

From Familia Cerezo
Subject libpq library
Date
Msg-id 000501bf64eb$56f433c0$733d243e@es
Whole thread Raw
List 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.

pgsql-general by date:

Previous
From: Peter Mount
Date:
Subject: Re: [GENERAL] jdbc connect in StarOffice
Next
From: Web Manager
Date:
Subject: Repost: restore from dump problem - query buffer full