summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/ecpglib/misc.c
AgeCommit message (Collapse)Author
2020-10-24Fix ancient bug in ecpg's pthread_once() emulation for Windows.Tom Lane
We must not set the "done" flag until after we've executed the initialization function. Otherwise, other threads can fall through the initial unlocked test before initialization is really complete. This has been seen to cause rare failures of ecpg's thread/descriptor test, and it could presumably cause other sorts of misbehavior in threaded ECPG-using applications, since ecpglib relies on pthread_once() in several places. Diagnosis and patch by me, based on investigation by Alexander Lakhin. Back-patch to all supported branches (the bug dates to 2007). Discussion: https://postgr.es/m/16685-d6cd241872c101d3@postgresql.org
2019-11-25Make the order of the header file includes consistent.Amit Kapila
Similar to commits 14aec03502, 7e735035f2 and dddf4cdc33, this commit makes the order of header file inclusion consistent in more places. Author: Vignesh C Reviewed-by: Amit Kapila Discussion: https://postgr.es/m/CALDaNm2Sznv8RR6Ex-iJO6xAdsxgWhCoETkaYX=+9DW3q0QCfA@mail.gmail.com
2019-11-07Remove HAVE_LONG_LONG_INTPeter Eisentraut
The presence of long long int is now implied in the requirement for C99 and the configure check for the same. We keep the define hard-coded in ecpg_config.h for backward compatibility with ecpg-using user code. Discussion: https://www.postgresql.org/message-id/flat/5cdd6a2b-b2c7-c6f6-344c-a406d5c1a254%402ndquadrant.com
2019-10-25Make the order of the header file includes consistent in non-backend modules.Amit Kapila
Similar to commit 7e735035f2, this commit makes the order of header file inclusion consistent for non-backend modules. In passing, fix the case where we were using angle brackets (<>) for the local module includes instead of quotes (""). Author: Vignesh C Reviewed-by: Amit Kapila Discussion: https://postgr.es/m/CALDaNm2Sznv8RR6Ex-iJO6xAdsxgWhCoETkaYX=+9DW3q0QCfA@mail.gmail.com
2019-03-01Fix whitespacePeter Eisentraut
2019-02-22Add const qualifierPeter Eisentraut
New code introduced in 050710b36964dee7e1b2bf6b5ef00041fd5d2787. The lack of const is not currently a compiler warning, but it's nice to have for consistency with surrounding code.
2019-02-18Add bytea datatype to ECPG.Michael Meskes
So far ECPG programs had to treat binary data for bytea column as 'char' type. But this meant converting from/to escaped format with PQunescapeBytea/ PQescapeBytea() and therefore forcing users to add unnecessary code and cost for the conversion in runtime. By adding a dedicated datatype for bytea most of this special handling is no longer needed. Author: Matsumura-san ("Matsumura, Ryo" <matsumura.ryo@jp.fujitsu.com>) Discussion: https://postgr.es/m/flat/03040DFF97E6E54E88D3BFEE5F5480F737A141F9@G01JPEXMBYT04
2019-01-30Change error handling of out of scope variables in ecpg.Michael Meskes
The function called can result in an out of memory error that subsequently was disregarded. Instead it should set the appropriate SQL error variables and be checked by whatever whenever statement is defined.
2018-12-01Rename ecpg's various "extern.h" files to have distinct names.Tom Lane
This should reduce confusion, and in particular make it safe to copy typename.c into preproc/ and compile it there. This doesn't affect anything outside ecpg, and particularly not end users, because these files don't get installed; they just exist to share declarations among the .c files of each subdirectory. Discussion: https://postgr.es/m/31364.1543511708@sss.pgh.pa.us
2017-11-10Add some const decorations to prototypesPeter Eisentraut
Reviewed-by: Fabien COELHO <coelho@cri.ensmp.fr>
2017-11-08Change TRUE/FALSE to true/falsePeter Eisentraut
The lower case spellings are C and C++ standard and are used in most parts of the PostgreSQL sources. The upper case spellings are only used in some files/modules. So standardize on the standard spellings. The APIs for ICU, Perl, and Windows define their own TRUE and FALSE, so those are left as is when using those APIs. In code comments, we use the lower-case spelling for the C concepts and keep the upper-case spelling for the SQL concepts. Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
2017-09-05Remove unnecessary parentheses in return statementsPeter Eisentraut
The parenthesized style has only been used in a few modules. Change that to use the style that is predominant across the whole tree. Reviewed-by: Michael Paquier <michael.paquier@gmail.com> Reviewed-by: Ryan Murphy <ryanfmurphy@gmail.com>
2017-06-21Phase 2 of pgindent updates.Tom Lane
Change pg_bsd_indent to follow upstream rules for placement of comments to the right of code, and remove pgindent hack that caused comments following #endif to not obey the general rule. Commit e3860ffa4dd0dad0dd9eea4be9cc1412373a8c89 wasn't actually using the published version of pg_bsd_indent, but a hacked-up version that tried to minimize the amount of movement of comments to the right of code. The situation of interest is where such a comment has to be moved to the right of its default placement at column 33 because there's code there. BSD indent has always moved right in units of tab stops in such cases --- but in the previous incarnation, indent was working in 8-space tab stops, while now it knows we use 4-space tabs. So the net result is that in about half the cases, such comments are placed one tab stop left of before. This is better all around: it leaves more room on the line for comment text, and it means that in such cases the comment uniformly starts at the next 4-space tab stop after the code, rather than sometimes one and sometimes two tabs after. Also, ensure that comments following #endif are indented the same as comments following other preprocessor commands such as #else. That inconsistency turns out to have been self-inflicted damage from a poorly-thought-through post-indent "fixup" in pgindent. This patch is much less interesting than the first round of indent changes, but also bulkier, so I thought it best to separate the effects. Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
2017-06-21Initial pgindent run with pg_bsd_indent version 2.0.Tom Lane
The new indent version includes numerous fixes thanks to Piotr Stefaniak. The main changes visible in this commit are: * Nicer formatting of function-pointer declarations. * No longer unexpectedly removes spaces in expressions using casts, sizeof, or offsetof. * No longer wants to add a space in "struct structname *varname", as well as some similar cases for const- or volatile-qualified pointers. * Declarations using PG_USED_FOR_ASSERTS_ONLY are formatted more nicely. * Fixes bug where comments following declarations were sometimes placed with no space separating them from the code. * Fixes some odd decisions for comments following case labels. * Fixes some cases where comments following code were indented to less than the expected column 33. On the less good side, it now tends to put more whitespace around typedef names that are not listed in typedefs.list. This might encourage us to put more effort into typedef name collection; it's not really a bug in indent itself. There are more changes coming after this round, having to do with comment indentation and alignment of lines appearing within parentheses. I wanted to limit the size of the diffs to something that could be reviewed without one's eyes completely glazing over, so it seemed better to split up the changes as much as practical. Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
2017-03-13Ecpg should support COMMIT PREPARED and ROLLBACK PREPARED.Michael Meskes
The problem was that "begin transaction" was issued automatically before executing COMMIT/ROLLBACK PREPARED if not in auto commit. This fix by Masahiko Sawada fixes this.
2015-06-15Check for out of memory when allocating sqlca.Michael Meskes
Patch by Michael Paquier
2014-07-20Replace "internationalize" with "localize" where appropriatePeter Eisentraut
2013-01-27Made ecpglib use translated messages.Michael Meskes
Bug reported and fixed by Chen Huajun <chenhj@cn.fujitsu.com>.
2012-03-08ecpg: Fix off-by-one error in memory copyingPeter Eisentraut
In a rare case, one byte past the end of memory belonging to the sqlca_t structure would be written to. found by Coverity
2012-01-05Ecpglib stores variables that are used in DECLARE statements in a global list.Michael Meskes
This list is now freed when the last connection has been closed. Closes: #6366
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-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-26Applied patch by Boszormenyi Zoltan <zb@cybertec.at> to add out-of-scope ↵Michael Meskes
cursor support to native mode.
2009-11-24Made function better readable.Michael Meskes
2009-09-18Added patch by Bernd Helmle <bernd.helmle@credativ.de> that adds a low levelMichael Meskes
function that returns the current transaction status.
2009-09-03Do not set connection values if no connection is open.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-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.
2009-01-02Split the ecpg translation support into a separate catalog for the ecpgPeter Eisentraut
preprocessor and the library. This is useful for a number of reasons: * The preprocessor and the library are in some cases installed in separate packages and used by different classes of users. * The library MO files need a different versioning scheme to account for the soname. * The makefiles are simpler, more robust, and easier to maintain this way. (NLS web site was prone to break everytime a build rule changes.) * Translators might choose to focus on the ecpglib, because that is more user-facing. * There was virtually no overlap, so nothing is lost.
2008-12-15Fix cast-away-const problem as well as bogus calculation of required buffer ↵Tom Lane
size.
2008-12-15Do not try to change a const variable.Michael Meskes
2008-12-11Append major version number and for libraries soname major version numberPeter Eisentraut
to the gettext domain name, to simplify parallel installations. Also, rename set_text_domain() to pg_bindtextdomain(), because that is what it does.
2008-11-01Move from strcmp to strncmp to be more tolerant for changes to the parser.Michael Meskes
2008-05-16Add localization support to ecpg.Peter Eisentraut
Author: Euler Taveira de Oliveira <euler@timbira.com>
2007-11-15pgindent run for 8.3.Bruce Momjian
2007-10-03Cleaned up ecpglib and renamed functions that do not need to be exported.Michael Meskes
Created export list for ecpglib.
2007-10-03Hopefully fixed some stuff that causes Windows builds to fail.Michael Meskes
2007-10-02ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp> added thread-safeMichael Meskes
descriptor handling
2007-09-30Applied another patch by ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp>Michael Meskes
to get memory allocation thread-safe. He also did some cleaning up.
2007-08-14- Finished major rewrite to use new protocol versionMichael Meskes
- Really prepare statements - Added more regression tests - Added auto-prepare mode - Use '$n' for positional variables, '?' is still possible via ecpg option - Cleaned up the sources a little bit
2007-03-29- Added patch by Magnus Hagander <magnus@hagander.net> to use nativeMichael Meskes
win32 threads. - Fixed regression tests to run threading tests.
2007-01-12Simplified regression handlingMichael Meskes
Added patch by Joachim to work around OpenBSD bug in regression suite.
2007-01-11Applied Joachim's patch for a --regression option.Michael Meskes
Made this option mark the .c files, so the environment variable is no longer needed. Created a special MinGW file with the special error message. Do not print port into log file when running regression tests.
2006-10-04pgindent run for 8.2.Bruce Momjian