[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: [GENERAL] Problems with INSERT INTO?
From:       Dustin Sallings <dustin () spy ! net>
Date:       1999-05-24 17:34:51
[Download RAW message or body]

On Mon, 24 May 1999, Simon Drabble wrote:

# char query[LOTS_OF_ROOM];
# sprintf(query, "INSERT INTO octects VALUES(%d)", a);
# 
# PQexec(conn, query);

	snprintf would probably be a better choice.

# -or- download my libpq wrapper, which allows you to perform queries without
# using a temporary char array, in a manner similar to printf(). Available via
# anon ftp from
# 
# brainkarma.dyndns.org/pub/dblib/

	I was about to suggest something like this be part of the core
library.  It makes a lot of sense, and that's what vsnprintf is for.  :)

--
SA, beyond.com           My girlfriend asked me which one I like better.
pub  1024/3CAE01D5 1994/11/03 Dustin Sallings <dustin@spy.net>
|    Key fingerprint =  87 02 57 08 02 D0 DA D6  C8 0F 3E 65 51 98 D8 BE 
L_______________________ I hope the answer won't upset her. ____________

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic