LCOV - differential code coverage report
Current view: top level - src/interfaces/ecpg/ecpglib - error.c (source / functions) Coverage Total Hit UBC CBC
Current: Differential Code Coverage 16@8cea358b128 vs 17@8cea358b128 Lines: 37.2 % 180 67 113 67
Current Date: 2024-04-14 14:21:10 Functions: 100.0 % 4 4 4
Baseline: 16@8cea358b128 Branches: 35.5 % 62 22 40 22
Baseline Date: 2024-04-14 14:21:09 Line coverage date bins:
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed (240..) days: 37.2 % 180 67 113 67
Function coverage date bins:
(240..) days: 100.0 % 4 4 4
Branch coverage date bins:
(240..) days: 35.5 % 62 22 40 22

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : /* src/interfaces/ecpg/ecpglib/error.c */
                                  2                 :                : 
                                  3                 :                : #define POSTGRES_ECPG_INTERNAL
                                  4                 :                : #include "postgres_fe.h"
                                  5                 :                : 
                                  6                 :                : #include "ecpgerrno.h"
                                  7                 :                : #include "ecpglib.h"
                                  8                 :                : #include "ecpglib_extern.h"
                                  9                 :                : #include "ecpgtype.h"
                                 10                 :                : #include "sqlca.h"
                                 11                 :                : 
                                 12                 :                : void
 6038 meskes@postgresql.or       13                 :CBC          47 : ecpg_raise(int line, int code, const char *sqlstate, const char *str)
                                 14                 :                : {
 7609 bruce@momjian.us           15                 :             47 :     struct sqlca_t *sqlca = ECPGget_sqlca();
                                 16                 :                : 
 3226 meskes@postgresql.or       17         [ -  + ]:             47 :     if (sqlca == NULL)
                                 18                 :                :     {
 3226 meskes@postgresql.or       19                 :UBC           0 :         ecpg_log("out of memory");
                                 20                 :              0 :         ECPGfree_auto_mem();
                                 21                 :              0 :         return;
                                 22                 :                :     }
                                 23                 :                : 
 7609 bruce@momjian.us           24                 :CBC          47 :     sqlca->sqlcode = code;
 7562 peter_e@gmx.net            25                 :             47 :     strncpy(sqlca->sqlstate, sqlstate, sizeof(sqlca->sqlstate));
                                 26                 :                : 
 7700 meskes@postgresql.or       27   [ +  -  -  -  :             47 :     switch (code)
                                     -  -  -  -  -  
                                     -  +  -  -  -  
                                     +  -  +  -  -  
                                     -  -  -  -  +  
                                                 - ]
                                 28                 :                :     {
                                 29                 :             24 :         case ECPG_NOT_FOUND:
 7609 bruce@momjian.us           30                 :             24 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                 31                 :                :             /*------
                                 32                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5812 peter_e@gmx.net            33                 :             24 :                      ecpg_gettext("no data found on line %d"), line);
 7700 meskes@postgresql.or       34                 :             24 :             break;
                                 35                 :                : 
 7700 meskes@postgresql.or       36                 :UBC           0 :         case ECPG_OUT_OF_MEMORY:
 7609 bruce@momjian.us           37                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                 38                 :                :             /*------
                                 39                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5812 peter_e@gmx.net            40                 :              0 :                      ecpg_gettext("out of memory on line %d"), line);
 7700 meskes@postgresql.or       41                 :              0 :             break;
                                 42                 :                : 
                                 43                 :              0 :         case ECPG_UNSUPPORTED:
 7609 bruce@momjian.us           44                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                 45                 :                :             /*------
                                 46                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 2489 tgl@sss.pgh.pa.us          47                 :              0 :                      ecpg_gettext("unsupported type \"%s\" on line %d"), str, line);
 7700 meskes@postgresql.or       48                 :              0 :             break;
                                 49                 :                : 
                                 50                 :              0 :         case ECPG_TOO_MANY_ARGUMENTS:
 7609 bruce@momjian.us           51                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                 52                 :                :             /*------
                                 53                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5812 peter_e@gmx.net            54                 :              0 :                      ecpg_gettext("too many arguments on line %d"), line);
 7700 meskes@postgresql.or       55                 :              0 :             break;
                                 56                 :                : 
                                 57                 :              0 :         case ECPG_TOO_FEW_ARGUMENTS:
 7609 bruce@momjian.us           58                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                 59                 :                :             /*------
                                 60                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5812 peter_e@gmx.net            61                 :              0 :                      ecpg_gettext("too few arguments on line %d"), line);
 7700 meskes@postgresql.or       62                 :              0 :             break;
                                 63                 :                : 
                                 64                 :              0 :         case ECPG_INT_FORMAT:
 7609 bruce@momjian.us           65                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                 66                 :                :             /*------
                                 67                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5568 peter_e@gmx.net            68                 :              0 :                      ecpg_gettext("invalid input syntax for type int: \"%s\", on line %d"), str, line);
 7700 meskes@postgresql.or       69                 :              0 :             break;
                                 70                 :                : 
                                 71                 :              0 :         case ECPG_UINT_FORMAT:
 7609 bruce@momjian.us           72                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                 73                 :                :             /*------
                                 74                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5568 peter_e@gmx.net            75                 :              0 :                      ecpg_gettext("invalid input syntax for type unsigned int: \"%s\", on line %d"), str, line);
 7700 meskes@postgresql.or       76                 :              0 :             break;
                                 77                 :                : 
                                 78                 :              0 :         case ECPG_FLOAT_FORMAT:
 7609 bruce@momjian.us           79                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                 80                 :                :             /*------
                                 81                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5568 peter_e@gmx.net            82                 :              0 :                      ecpg_gettext("invalid input syntax for floating-point type: \"%s\", on line %d"), str, line);
 7700 meskes@postgresql.or       83                 :              0 :             break;
                                 84                 :                : 
                                 85                 :              0 :         case ECPG_CONVERT_BOOL:
 5568 peter_e@gmx.net            86         [ #  # ]:              0 :             if (str)
                                 87                 :              0 :                 snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                 88                 :                :                 /*------
                                 89                 :                :                    translator: this string will be truncated at 149 characters expanded.  */
                                 90                 :              0 :                          ecpg_gettext("invalid syntax for type boolean: \"%s\", on line %d"), str, line);
                                 91                 :                :             else
                                 92                 :              0 :                 snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                 93                 :                :                 /*------
                                 94                 :                :                    translator: this string will be truncated at 149 characters expanded.  */
                                 95                 :              0 :                          ecpg_gettext("could not convert boolean value: size mismatch, on line %d"), line);
 7700 meskes@postgresql.or       96                 :              0 :             break;
                                 97                 :                : 
                                 98                 :              0 :         case ECPG_EMPTY:
 7609 bruce@momjian.us           99                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                100                 :                :             /*------
                                101                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5812 peter_e@gmx.net           102                 :              0 :                      ecpg_gettext("empty query on line %d"), line);
 7700 meskes@postgresql.or      103                 :              0 :             break;
                                104                 :                : 
 7700 meskes@postgresql.or      105                 :CBC           6 :         case ECPG_MISSING_INDICATOR:
 7609 bruce@momjian.us          106                 :              6 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                107                 :                :             /*------
                                108                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 2489 tgl@sss.pgh.pa.us         109                 :              6 :                      ecpg_gettext("null value without indicator on line %d"), line);
 7700 meskes@postgresql.or      110                 :              6 :             break;
                                111                 :                : 
 7700 meskes@postgresql.or      112                 :UBC           0 :         case ECPG_NO_ARRAY:
 7609 bruce@momjian.us          113                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                114                 :                :             /*------
                                115                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5567 peter_e@gmx.net           116                 :              0 :                      ecpg_gettext("variable does not have an array type on line %d"), line);
 7700 meskes@postgresql.or      117                 :              0 :             break;
                                118                 :                : 
                                119                 :              0 :         case ECPG_DATA_NOT_ARRAY:
 7609 bruce@momjian.us          120                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                121                 :                :             /*------
                                122                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5568 peter_e@gmx.net           123                 :              0 :                      ecpg_gettext("data read from server is not an array on line %d"), line);
 7700 meskes@postgresql.or      124                 :              0 :             break;
                                125                 :                : 
                                126                 :              0 :         case ECPG_ARRAY_INSERT:
 7609 bruce@momjian.us          127                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                128                 :                :             /*------
                                129                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5421                           130                 :              0 :                      ecpg_gettext("inserting an array of variables is not supported on line %d"), line);
 7700 meskes@postgresql.or      131                 :              0 :             break;
                                132                 :                : 
 7700 meskes@postgresql.or      133                 :CBC          14 :         case ECPG_NO_CONN:
 7609 bruce@momjian.us          134                 :             14 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                135                 :                :             /*------
                                136                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5421                           137                 :             14 :                      ecpg_gettext("connection \"%s\" does not exist on line %d"), str, line);
 7700 meskes@postgresql.or      138                 :             14 :             break;
                                139                 :                : 
 7700 meskes@postgresql.or      140                 :UBC           0 :         case ECPG_NOT_CONN:
 7609 bruce@momjian.us          141                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                142                 :                :             /*------
                                143                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5421                           144                 :              0 :                      ecpg_gettext("not connected to connection \"%s\" on line %d"), str, line);
 7700 meskes@postgresql.or      145                 :              0 :             break;
                                146                 :                : 
 7700 meskes@postgresql.or      147                 :CBC           1 :         case ECPG_INVALID_STMT:
 7609 bruce@momjian.us          148                 :              1 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                149                 :                :             /*------
                                150                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5421                           151                 :              1 :                      ecpg_gettext("invalid statement name \"%s\" on line %d"), str, line);
 7700 meskes@postgresql.or      152                 :              1 :             break;
                                153                 :                : 
 7700 meskes@postgresql.or      154                 :UBC           0 :         case ECPG_UNKNOWN_DESCRIPTOR:
 7609 bruce@momjian.us          155                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                156                 :                :             /*------
                                157                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5421                           158                 :              0 :                      ecpg_gettext("descriptor \"%s\" not found on line %d"), str, line);
 7700 meskes@postgresql.or      159                 :              0 :             break;
                                160                 :                : 
                                161                 :              0 :         case ECPG_INVALID_DESCRIPTOR_INDEX:
 7609 bruce@momjian.us          162                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                163                 :                :             /*------
                                164                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 2489 tgl@sss.pgh.pa.us         165                 :              0 :                      ecpg_gettext("descriptor index out of range on line %d"), line);
 7700 meskes@postgresql.or      166                 :              0 :             break;
                                167                 :                : 
                                168                 :              0 :         case ECPG_UNKNOWN_DESCRIPTOR_ITEM:
 7609 bruce@momjian.us          169                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                170                 :                :             /*------
                                171                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5421                           172                 :              0 :                      ecpg_gettext("unrecognized descriptor item \"%s\" on line %d"), str, line);
 7700 meskes@postgresql.or      173                 :              0 :             break;
                                174                 :                : 
                                175                 :              0 :         case ECPG_VAR_NOT_NUMERIC:
 7609 bruce@momjian.us          176                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                177                 :                :             /*------
                                178                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5421                           179                 :              0 :                      ecpg_gettext("variable does not have a numeric type on line %d"), line);
 7700 meskes@postgresql.or      180                 :              0 :             break;
                                181                 :                : 
                                182                 :              0 :         case ECPG_VAR_NOT_CHAR:
 7609 bruce@momjian.us          183                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                184                 :                :             /*------
                                185                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5421                           186                 :              0 :                      ecpg_gettext("variable does not have a character type on line %d"), line);
 7700 meskes@postgresql.or      187                 :              0 :             break;
                                188                 :                : 
                                189                 :              0 :         case ECPG_TRANS:
 7609 bruce@momjian.us          190                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                191                 :                :             /*------
                                192                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 2489 tgl@sss.pgh.pa.us         193                 :              0 :                      ecpg_gettext("error in transaction processing on line %d"), line);
 7700 meskes@postgresql.or      194                 :              0 :             break;
                                195                 :                : 
 7700 meskes@postgresql.or      196                 :CBC           2 :         case ECPG_CONNECT:
 7609 bruce@momjian.us          197                 :              2 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                198                 :                :             /*------
                                199                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5421                           200                 :              2 :                      ecpg_gettext("could not connect to database \"%s\" on line %d"), str, line);
 7700 meskes@postgresql.or      201                 :              2 :             break;
                                202                 :                : 
 7700 meskes@postgresql.or      203                 :UBC           0 :         default:
 7609 bruce@momjian.us          204                 :              0 :             snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc),
                                205                 :                :             /*------
                                206                 :                :                translator: this string will be truncated at 149 characters expanded.  */
 5421                           207                 :              0 :                      ecpg_gettext("SQL error %d on line %d"), code, line);
 7700 meskes@postgresql.or      208                 :              0 :             break;
                                209                 :                :     }
                                210                 :                : 
 7609 bruce@momjian.us          211                 :CBC          47 :     sqlca->sqlerrm.sqlerrml = strlen(sqlca->sqlerrm.sqlerrmc);
 5812 peter_e@gmx.net           212                 :             47 :     ecpg_log("raising sqlcode %d on line %d: %s\n", code, line, sqlca->sqlerrm.sqlerrmc);
                                213                 :                : 
                                214                 :                :     /* free all memory we have allocated for the user */
 7700 meskes@postgresql.or      215                 :             47 :     ECPGfree_auto_mem();
                                216                 :                : }
                                217                 :                : 
                                218                 :                : void
 6038                           219                 :             13 : ecpg_raise_backend(int line, PGresult *result, PGconn *conn, int compat)
                                220                 :                : {
 7562 peter_e@gmx.net           221                 :             13 :     struct sqlca_t *sqlca = ECPGget_sqlca();
                                222                 :                :     char       *sqlstate;
                                223                 :                :     char       *message;
                                224                 :                : 
 3226 meskes@postgresql.or      225         [ -  + ]:             13 :     if (sqlca == NULL)
                                226                 :                :     {
 3226 meskes@postgresql.or      227                 :UBC           0 :         ecpg_log("out of memory");
                                228                 :              0 :         ECPGfree_auto_mem();
                                229                 :              0 :         return;
                                230                 :                :     }
                                231                 :                : 
                                232                 :                :     /*
                                233                 :                :      * PQresultErrorField will return NULL if "result" is NULL, or if there is
                                234                 :                :      * no such field, which will happen for libpq-generated errors.  Fall back
                                235                 :                :      * to PQerrorMessage in such cases.
                                236                 :                :      */
  678 tgl@sss.pgh.pa.us         237                 :CBC          13 :     sqlstate = PQresultErrorField(result, PG_DIAG_SQLSTATE);
                                238         [ -  + ]:             13 :     if (sqlstate == NULL)
 7555 peter_e@gmx.net           239                 :UBC           0 :         sqlstate = ECPG_SQLSTATE_ECPG_INTERNAL_ERROR;
  678 tgl@sss.pgh.pa.us         240                 :CBC          13 :     message = PQresultErrorField(result, PG_DIAG_MESSAGE_PRIMARY);
                                241         [ -  + ]:             13 :     if (message == NULL)
 7555 peter_e@gmx.net           242                 :UBC           0 :         message = PQerrorMessage(conn);
                                243                 :                : 
 5151 meskes@postgresql.or      244         [ -  + ]:CBC          13 :     if (strcmp(sqlstate, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR) == 0)
                                245                 :                :     {
                                246                 :                :         /*
                                247                 :                :          * we might get here if the connection breaks down, so let's check for
                                248                 :                :          * this instead of giving just the generic internal error
                                249                 :                :          */
 5154 meskes@postgresql.or      250         [ #  # ]:UBC           0 :         if (PQstatus(conn) == CONNECTION_BAD)
                                251                 :                :         {
                                252                 :              0 :             sqlstate = "57P02";
                                253                 :              0 :             message = ecpg_gettext("the connection to the server was lost");
                                254                 :                :         }
                                255                 :                :     }
                                256                 :                : 
                                257                 :                :     /* copy error message */
 5812 peter_e@gmx.net           258                 :CBC          13 :     snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), "%s on line %d", message, line);
 7562                           259                 :             13 :     sqlca->sqlerrm.sqlerrml = strlen(sqlca->sqlerrm.sqlerrmc);
                                260                 :                : 
                                261                 :                :     /* copy SQLSTATE */
 7555                           262                 :             13 :     strncpy(sqlca->sqlstate, sqlstate, sizeof(sqlca->sqlstate));
                                263                 :                : 
                                264                 :                :     /* assign SQLCODE for backward compatibility */
 7559 bruce@momjian.us          265         [ +  + ]:             13 :     if (strncmp(sqlca->sqlstate, "23505", sizeof(sqlca->sqlstate)) == 0)
 7562 peter_e@gmx.net           266   [ -  +  -  - ]:              1 :         sqlca->sqlcode = INFORMIX_MODE(compat) ? ECPG_INFORMIX_DUPLICATE_KEY : ECPG_DUPLICATE_KEY;
 6603 meskes@postgresql.or      267         [ +  + ]:             12 :     else if (strncmp(sqlca->sqlstate, "21000", sizeof(sqlca->sqlstate)) == 0)
 7562 peter_e@gmx.net           268   [ -  +  -  - ]:              1 :         sqlca->sqlcode = INFORMIX_MODE(compat) ? ECPG_INFORMIX_SUBSELECT_NOT_ONE : ECPG_SUBSELECT_NOT_ONE;
                                269                 :                :     else
                                270                 :             11 :         sqlca->sqlcode = ECPG_PGSQL;
                                271                 :                : 
 4600                           272                 :             13 :     ecpg_log("raising sqlstate %.*s (sqlcode %ld): %s\n",
 4599                           273                 :             13 :              (int) sizeof(sqlca->sqlstate), sqlca->sqlstate, sqlca->sqlcode, sqlca->sqlerrm.sqlerrmc);
                                274                 :                : 
                                275                 :                :     /* free all memory we have allocated for the user */
 7562                           276                 :             13 :     ECPGfree_auto_mem();
                                277                 :                : }
                                278                 :                : 
                                279                 :                : /* filter out all error codes */
                                280                 :                : bool
 5995 bruce@momjian.us          281                 :           4607 : ecpg_check_PQresult(PGresult *results, int lineno, PGconn *connection, enum COMPAT_MODE compat)
                                282                 :                : {
 6088 meskes@postgresql.or      283         [ -  + ]:           4607 :     if (results == NULL)
                                284                 :                :     {
 5154 meskes@postgresql.or      285                 :UBC           0 :         ecpg_log("ecpg_check_PQresult on line %d: no result - %s", lineno, PQerrorMessage(connection));
 6038                           286                 :              0 :         ecpg_raise_backend(lineno, NULL, connection, compat);
 2432 peter_e@gmx.net           287                 :              0 :         return false;
                                288                 :                :     }
                                289                 :                : 
 6088 meskes@postgresql.or      290   [ +  -  +  +  :CBC        4607 :     switch (PQresultStatus(results))
                                           +  -  - ]
                                291                 :                :     {
                                292                 :                : 
                                293                 :           1052 :         case PGRES_TUPLES_OK:
 2432 peter_e@gmx.net           294                 :           1052 :             return true;
                                295                 :                :             break;
 6088 meskes@postgresql.or      296                 :UBC           0 :         case PGRES_EMPTY_QUERY:
                                297                 :                :             /* do nothing */
 6038                           298                 :              0 :             ecpg_raise(lineno, ECPG_EMPTY, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, NULL);
 6088                           299                 :              0 :             PQclear(results);
 2432 peter_e@gmx.net           300                 :              0 :             return false;
                                301                 :                :             break;
 6088 meskes@postgresql.or      302                 :CBC        3541 :         case PGRES_COMMAND_OK:
 2432 peter_e@gmx.net           303                 :           3541 :             return true;
                                304                 :                :             break;
 6088 meskes@postgresql.or      305                 :             13 :         case PGRES_NONFATAL_ERROR:
                                306                 :                :         case PGRES_FATAL_ERROR:
                                307                 :                :         case PGRES_BAD_RESPONSE:
 5154                           308                 :             13 :             ecpg_log("ecpg_check_PQresult on line %d: bad response - %s", lineno, PQresultErrorMessage(results));
 6038                           309                 :             13 :             ecpg_raise_backend(lineno, results, connection, compat);
 6088                           310                 :             13 :             PQclear(results);
 2432 peter_e@gmx.net           311                 :             13 :             return false;
                                312                 :                :             break;
 6088 meskes@postgresql.or      313                 :              1 :         case PGRES_COPY_OUT:
 2432 peter_e@gmx.net           314                 :              1 :             return true;
                                315                 :                :             break;
 6088 meskes@postgresql.or      316                 :UBC           0 :         case PGRES_COPY_IN:
 5812 peter_e@gmx.net           317                 :              0 :             ecpg_log("ecpg_check_PQresult on line %d: COPY IN data transfer in progress\n", lineno);
 6088 meskes@postgresql.or      318                 :              0 :             PQendcopy(connection);
                                319                 :              0 :             PQclear(results);
 2432 peter_e@gmx.net           320                 :              0 :             return false;
                                321                 :                :             break;
 6088 meskes@postgresql.or      322                 :              0 :         default:
 5812 peter_e@gmx.net           323                 :              0 :             ecpg_log("ecpg_check_PQresult on line %d: unknown execution status type\n",
                                324                 :                :                      lineno);
 6038 meskes@postgresql.or      325                 :              0 :             ecpg_raise_backend(lineno, results, connection, compat);
 6088                           326                 :              0 :             PQclear(results);
 2432 peter_e@gmx.net           327                 :              0 :             return false;
                                328                 :                :             break;
                                329                 :                :     }
                                330                 :                : }
                                331                 :                : 
                                332                 :                : /* print out an error message */
                                333                 :                : void
 7700 meskes@postgresql.or      334                 :CBC          14 : sqlprint(void)
                                335                 :                : {
 7609 bruce@momjian.us          336                 :             14 :     struct sqlca_t *sqlca = ECPGget_sqlca();
                                337                 :                : 
 3226 meskes@postgresql.or      338         [ -  + ]:             14 :     if (sqlca == NULL)
                                339                 :                :     {
 3226 meskes@postgresql.or      340                 :UBC           0 :         ecpg_log("out of memory");
                                341                 :              0 :         return;
                                342                 :                :     }
                                343                 :                : 
 7609 bruce@momjian.us          344                 :CBC          14 :     sqlca->sqlerrm.sqlerrmc[sqlca->sqlerrm.sqlerrml] = '\0';
 5568 peter_e@gmx.net           345                 :             14 :     fprintf(stderr, ecpg_gettext("SQL error: %s\n"), sqlca->sqlerrm.sqlerrmc);
                                346                 :                : }
        

Generated by: LCOV version 2.1-beta2-3-g6141622