lib/conn_quote.c
/*
 * call-seq:
 *    conn.quote_identifier() -> str
 *
 * Put double quotes around an identifier containing non-letters
 * or upper case.
 */


Put double quotes around an identifier containing non-letters
or upper case.
Put double quotes around an identifier containing non - letters or upper case .
VALUE
pgconn_quote_identifier( VALUE self, VALUE str)
{
    char *p;
    VALUE res;
    if (NIL_P( str))
        return Qnil;
    StringValue( str);
    p = PQescapeIdentifier( get_pgconn( self)->conn, RSTRING_PTR( str), RSTRING_LEN( str));
    res = rb_str_new2( p);
    PQfreemem( p);
    rb_enc_associate( res, rb_enc_get( str));
    OBJ_INFECT( res, str);
    return res;
}
VALUE pgconn_quote_identifier ( VALUE self , VALUE str ) { char * p ; VALUE res ; if ( NIL_P ( str ) ) return Qnil ; StringValue ( str ) ; p = PQescapeIdentifier ( get_pgconn ( self ) -> conn , RSTRING_PTR ( str ) , RSTRING_LEN ( str ) ) ; res = rb_str_new2 ( p ) ; PQfreemem ( p ) ; rb_enc_associate ( res , rb_enc_get ( str ) ) ; OBJ_INFECT ( res , str ) ; return res ; }
call-seq:
    conn.quote_identifier() -> str
call - seq : conn . quote_identifier () - > str