summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/execute.c
AgeCommit message (Collapse)Author
2015-09-21Fix whitespacePeter Eisentraut
2015-09-17Let compiler handle size calculation of bool types.Michael Meskes
Back in the day this did not work, but modern compilers should handle it themselves.
2015-08-13Fix declaration of isarray variable.Michael Meskes
Found and fixed by Andres Freund.
2015-06-15Check for out of memory when allocating sqlca.Michael Meskes
Patch by Michael Paquier
2015-05-23pgindent run for 9.5Bruce Momjian
2015-02-10Fixed array handling in ecpg.Michael Meskes
When ecpg was rewritten to the new protocol version not all variable types were corrected. This patch rewrites the code for these types to fix that. It also fixes the documentation to correctly tell the status of array handling.
2015-02-05This routine was calling ecpg_alloc to allocate to memory but did notMichael Meskes
actually check the returned pointer allocated, potentially NULL which could be the result of a malloc call. Issue noted by Coverity, fixed by Michael Paquier <michael@otacoo.com>
2015-02-04Fix memory leaks on OOM in ecpg.Heikki Linnakangas
These are fairly obscure cases, but let's keep Coverity happy. Michael Paquier with some further fixes by me.
2015-01-24Replace a bunch more uses of strncpy() with safer coding.Tom Lane
strncpy() has a well-deserved reputation for being unsafe, so make an effort to get rid of nearly all occurrences in HEAD. A large fraction of the remaining uses were passing length less than or equal to the known strlen() of the source, in which case no null-padding can occur and the behavior is equivalent to memcpy(), though doubtless slower and certainly harder to reason about. So just use memcpy() in these cases. In other cases, use either StrNCpy() or strlcpy() as appropriate (depending on whether padding to the full length of the destination buffer seems useful). I left a few strncpy() calls alone in the src/timezone/ code, to keep it in sync with upstream (the IANA tzcode distribution). There are also a few such calls in ecpg that could possibly do with more analysis. AFAICT, none of these changes are more than cosmetic, except for the four occurrences in fe-secure-openssl.c, which are in fact buggy: an overlength source leads to a non-null-terminated destination buffer and ensuing misbehavior. These don't seem like security issues, first because no stack clobber is possible and second because if your values of sslcert etc are coming from untrusted sources then you've got problems way worse than this. Still, it's undesirable to have unpredictable behavior for overlength inputs, so back-patch those four changes to all active branches.
2014-05-06pgindent run for 9.4Bruce Momjian
This includes removing tabs after periods in C comments, which was applied to back branches, so this change should not effect backpatching.
2014-05-06Fix handling of array of char pointers in ecpglib.Michael Meskes
When array of char * was used as target for a FETCH statement returning more than one row, it tried to store all the result in the first element. Instead it should dump array of char pointers with right offset, use the address instead of the value of the C variable while reading the array and treat such variable as char **, instead of char * for pointer arithmetic. Patch by Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
2014-03-01Various Coverity-spotted fixesStephen Frost
A number of issues were identified by the Coverity scanner and are addressed in this patch. None of these appear to be security issues and many are mostly cosmetic changes. Short comments for each of the changes follows. Correct the semi-colon placement in be-secure.c regarding SSL retries. Remove a useless comparison-to-NULL in proc.c (value is dereferenced prior to this check and therefore can't be NULL). Add checking of chmod() return values to initdb. Fix a couple minor memory leaks in initdb. Fix memory leak in pg_ctl- involves free'ing the config file contents. Use an int to capture fgetc() return instead of an enum in pg_dump. Fix minor memory leaks in pg_dump. (note minor change to convertOperatorReference()'s API) Check fclose()/remove() return codes in psql. Check fstat(), find_my_exec() return codes in psql. Various ECPG memory leak fixes. Check find_my_exec() return in ECPG. Explicitly ignore pqFlush return in libpq error-path. Change PQfnumber() to avoid doing an strdup() when no changes required. Remove a few useless check-against-NULL's (value deref'd beforehand). Check rmtree(), malloc() results in pg_regress. Also check get_alternative_expectfile() return in pg_regress.
2014-01-16Split ecpg_execute() in constituent partsAlvaro Herrera
Split the rather long ecpg_execute() function into ecpg_build_params(), ecpg_autostart_transaction(), a smaller ecpg_execute() and ecpg_process_output(). There is no user-visible change here, only code reorganization to support future patches. Author: Zoltán Böszörményi Reviewed by Antonin Houska. Larger, older versions of this patch were reviewed by Noah Misch and Michael Meskes.
2014-01-16Split ECPGdo() in constituent partsAlvaro Herrera
This splits ECPGdo() into ecpg_prologue(), ecpg_do() and ecpg_epilogue(), and renames free_params() into ecpg_free_params() and exports it. This makes it possible for future code to use these routines for their own purposes. There is no user-visible functionality change here, only code reorganization. Zoltán Böszörményi Reviewed by Antonin Houska. Larger, older versions of this patch were reviewed by Noah Misch and Michael Meskes.
2013-11-26ECPG: Simplify free_variable()Michael Meskes
Patch by Boszormenyi Zoltan <zb@cybertec.at>
2012-06-10Run pgindent on 9.2 source tree in preparation for first 9.3Bruce Momjian
commit-fest.
2012-03-08ecpg: Fix rare memory leaksPeter Eisentraut
found by Coverity
2012-03-02ecpg: Clean up some const usagePeter Eisentraut
2011-12-27Standardize treatment of strcmp() return valuePeter Eisentraut
Always compare the return value to 0, don't use cute tricks like if (!strcmp(...)).
2011-09-11Remove many -Wcast-qual warningsPeter Eisentraut
This addresses only those cases that are easy to fix by adding or moving a const qualifier or removing an unnecessary cast. There are many more complicated cases remaining.
2011-09-10Add missing format attributesPeter Eisentraut
Add __attribute__ decorations for printf format checking to the places that were missing them. Fix the resulting warnings. Add -Wmissing-format-attribute to the standard set of warnings for GCC, so these don't happen again. The warning fixes here are relatively harmless. The one serious problem discovered by this was already committed earlier in cf15fb5cabfbc71e07be23cfbc813daee6c5014f.
2011-09-08Add missing format argument to ecpg_log() callPeter Eisentraut
2011-09-02Fix brace indentation of commit 63d06ef59156719efd0208c62e764a69611b3f12 to ↵Michael Meskes
fit PostgreSQL style.
2011-09-01In ecpglib restore LC_NUMERIC in case of an error.Michael Meskes
2011-07-18Made ecpglib write double with a precision of 15 digits.Michael Meskes
Patch originally by Akira Kurosawa <kurosawa-akira@mxc.nes.nec.co.jp>.
2011-06-19Capitalization fixesPeter Eisentraut
2011-04-27Revert "Remove hard coded formats for INT64 and use configured settings ↵Andrew Dunstan
instead." This reverts commit 9b1508af8971c1627cda5bb65f5e9eddb9a1a55e. As requested by Tom.
2011-04-27Remove hard coded formats for INT64 and use configured settings instead.Andrew Dunstan
2010-10-14Applied patch by Itagaki Takahiro to fix incorrect status calculation inMichael Meskes
ecpglib. Instead of parsing the statement just as ask the database server. This patch removes the whole client side track keeping of the current transaction status.
2010-09-20Remove cvs keywords from all files.Magnus Hagander
2010-07-06pgindent run for 9.0, second runBruce Momjian
2010-05-25Replace self written 'long long int' configure test by standard ↵Michael Meskes
'AC_TYPE_LONG_LONG_INT' macro call.
2010-05-20Ecpg now accepts "long long" datatypes even if "long" is 64bit wide. This ↵Michael Meskes
used to cover the equally long "long long" type. This patch closes bug #5464.
2010-02-26pgindent run for 9.0Bruce Momjian
2010-02-16Do not check nan values for infinity. Some system are not able to handle this.Michael Meskes
By Zoltán Böszörményi
2010-02-04Streamlined array handling code in libecpg a little bit, in the process ↵Michael Meskes
fixing yet another incorrect log output.
2010-02-03Add #include <float.h> --- guessing the lack of this is why WindowsTom Lane
machines are all rejecting isinf() calls in this file.
2010-02-02Fixed NaN/Infinity problems in ECPG for float/double/numeric/decimal by ↵Michael Meskes
making it OS independant. Patch done by Zoltán Böszörményi.
2010-01-29Fixed a few typos in ecpg. Two were in comments, the third made a log output ↵Michael Meskes
reverse yes and no.
2010-01-22Applied patch by Boszormenyi Zoltan <zb@cybertec.at> to fix problem in ↵Michael Meskes
auto-prepare mode if the connection is closed and re-opened and the previously prepared query is issued again.
2010-01-05Applied patch by Boszormenyi Zoltan <zb@cybertec.at> to add sqlda support toMichael Meskes
ecpg in both native and compatiblity mode.
2009-09-03Fixed incorrect memory management.Michael Meskes
2009-08-07Added STRING datatype for Informix compatibility mode. This work isMichael Meskes
based on a patch send in by Böszörményi Zoltán <zb@cybertec.at>.
2009-06-118.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef listBruce Momjian
provided by Andrew.
2009-05-20Removed unsigned/signed mismatches.Michael Meskes
2009-05-20Removed some unneeded variables and comparisonsMichael Meskes
2009-02-03Argh, wrong line copied again.Michael Meskes
2009-02-03Fixed copy&paste mistake that made library use uninitialized variable.Michael Meskes
2009-02-02Fixed auto allocation for binary data types.Michael Meskes
2009-01-15NLS cleanup in ecpglibPeter Eisentraut
Replace leftover instances of _() by ecpg_gettext(), the latter being the correct way to refer to the library's message catalog, instead of the one of the program using the library. Drop NLS support for ecpg_log(), which is a debugging instrument similar to elog() in the backend. We cannot support NLS in the ecpg compatlib, because that requires ecpg_gettext, which is in ecpglib, which is not a dependency of compatlib. It doesn't seem worthwhile to worry about this, since the only translatable string is "out of memory", and gettext probably won't be able to do much without memory either. Adjust messages to project style.