diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-05-24 21:47:17 +0100 | 
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-05-24 21:47:17 +0100 | 
| commit | b4d6a348a7b43dc350103a5efe008bcf8d50daad (patch) | |
| tree | a940bf853ba716e2b4f41c18091ebb5ef1946106 | |
| parent | Use prepared statements for bulk selects (diff) | |
| download | libdbpp-postgresql-b4d6a348a7b43dc350103a5efe008bcf8d50daad.tar.bz2 libdbpp-postgresql-b4d6a348a7b43dc350103a5efe008bcf8d50daad.tar.xz libdbpp-postgresql-b4d6a348a7b43dc350103a5efe008bcf8d50daad.zip  | |
Don't truncate and create random breakage with over 100 params
| -rw-r--r-- | libpqpp/pq-command.cpp | 5 | 
1 files changed, 2 insertions, 3 deletions
diff --git a/libpqpp/pq-command.cpp b/libpqpp/pq-command.cpp index 790c7f7..14efa77 100644 --- a/libpqpp/pq-command.cpp +++ b/libpqpp/pq-command.cpp @@ -27,13 +27,12 @@ PQ::Command::~Command()  void  PQ::Command::prepareSql(std::string & psql, const std::string & sql)  { -	char buf[4]; +	char buf[10];  	int p = 1;  	bool inquote = false;  	for(std::string::const_iterator i = sql.begin(); i != sql.end(); ++i) {  		if (*i == '?' && !inquote) { -			snprintf(buf, 4, "$%d", p++); -			psql += buf; +			psql.append(buf, snprintf(buf, 10, "$%d", p++));  		}  		else if (*i == '\'') {  			inquote = !inquote;  | 
