Example #1
0
/*
 * XXX: Note that we return a malloc'd string, with a cleanup function
 * registered in the given pool. This might get expensive if used
 * frequently...
 */
char *
tuple_to_str(Tuple *tuple, Schema *s, apr_pool_t *pool)
{
    StrBuf *buf;

    buf = sbuf_make(pool);
    tuple_to_str_buf(tuple, s, buf);
    sbuf_append_char(buf, '\0');
    return buf->data;
}
Example #2
0
/*
 * XXX: Note that we return a malloc'd string, with a cleanup function
 * registered in the given context. This might get expensive if used
 * frequently...
 */
char *
tuple_to_sql_insert_str(Tuple *tuple, Schema *s, apr_pool_t *pool)
{
    StrBuf *buf;
    int i;

    buf = sbuf_make(pool);
    for (i = 0; i < s->len; i++)
    {
        if (i != 0)
            sbuf_append_char(buf, ',');
        if (s->types[i] == TYPE_STRING)
            sbuf_append_char(buf, '\'');

        (s->text_out_funcs[i])(tuple_get_val(tuple, i), buf);

        if (s->types[i] == TYPE_STRING)
            sbuf_append_char(buf, '\'');
    }

    sbuf_append_char(buf, '\0');
    return buf->data;
}
Example #3
0
void term_record(void)
{
	if (!term_sbuf)
		term_sbuf = sbuf_make();
}