~ubuntu-branches/debian/sid/unixodbc/sid

« back to all changes in this revision

Viewing changes to Drivers/Postgre7.1/connection.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2004-10-15 03:07:52 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20041015030752-dzw4vhxlgycz3woj
Tags: 2.2.4-11
Brown paper bag me: conflicts do not write themselves just because
you add a line to the changelog.

Show diffs side-by-side

added added

removed removed

Lines of Context:
951
951
                                self->errormsg = "No response from backend while receiving a portal query command";
952
952
                                mylog("send_query: 'C' - %s\n", self->errormsg);
953
953
                                CC_set_no_trans(self);
 
954
                if (res)
 
955
                    QR_Destructor(res);
954
956
                                return NULL;
955
957
                        } else {
956
958
 
958
960
 
959
961
                                mylog("send_query: ok - 'C' - %s\n", cmdbuffer);
960
962
 
 
963
                if (res)
 
964
                    QR_Destructor(res);
 
965
                
961
966
                                if (res == NULL)        /* allow for "show" style notices */
962
967
                                        res = QR_Constructor();
963
968
 
1029
1034
                case 'N' : /* NOTICE: */
1030
1035
                        SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
1031
1036
 
 
1037
            if (res)
 
1038
                QR_Destructor(res);
1032
1039
                        res = QR_Constructor();
1033
1040
                        QR_set_status(res, PGRES_NONFATAL_ERROR);
1034
1041
                        QR_set_notice(res, cmdbuffer);  /* will dup this string */
1044
1051
                        if ((swallow != '\0') || SOCK_get_errcode(sock) != 0) {
1045
1052
                                self->errornumber = CONNECTION_BACKEND_CRAZY;
1046
1053
                                self->errormsg = "Unexpected protocol character from backend (send_query - I)";
 
1054
                if (res)
 
1055
                    QR_Destructor(res);
1047
1056
                                res = QR_Constructor();
1048
1057
                                QR_set_status(res, PGRES_FATAL_ERROR);
1049
1058
                                return res;
1050
1059
                        } else {
1051
1060
                                /* We return the empty query */
 
1061
                if (res)
 
1062
                    QR_Destructor(res);
1052
1063
                                res = QR_Constructor();
1053
1064
                                QR_set_status(res, PGRES_EMPTY_QUERY);
1054
1065
                                return res;
1067
1078
                        qlog("ERROR from backend during send_query: '%s'\n", self->errormsg);
1068
1079
 
1069
1080
                        /* We should report that an error occured. Zoltan */
 
1081
            if (res)
 
1082
                QR_Destructor(res);
1070
1083
                        res = QR_Constructor();
1071
1084
 
1072
1085
                        if ( ! strncmp(self->errormsg, "FATAL", 5)) {
1094
1107
                                if ( ! result_in) {
1095
1108
                                        self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
1096
1109
                                        self->errormsg = "Could not create result info in send_query.";
 
1110
                    if (res)
 
1111
                        QR_Destructor(res);
1097
1112
                                        return NULL;
1098
1113
                                }
1099
1114
 
1102
1117
 
1103
1118
                                if ( ! QR_fetch_tuples(result_in, self, qi ? qi->cursor : NULL)) {
1104
1119
                                        self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
 
1120
                    if (res)
 
1121
                        QR_Destructor(res);
1105
1122
                                        self->errormsg = QR_get_message(result_in);
1106
1123
                                        return NULL;
1107
1124
                                }
1110
1127
                                if ( ! QR_fetch_tuples(result_in, NULL, NULL)) {
1111
1128
                                        self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
1112
1129
                                        self->errormsg = QR_get_message(result_in);
 
1130
                    if (res)
 
1131
                        QR_Destructor(res);
1113
1132
                                        return NULL;
1114
1133
                                }
1115
1134
                        }
1116
1135
 
1117
1136
                        return result_in;
1118
1137
                case 'D': /* Copy in command began successfully */
 
1138
            if (res)
 
1139
                QR_Destructor(res);
1119
1140
                        res = QR_Constructor();
1120
1141
                        QR_set_status(res, PGRES_COPY_IN);
1121
1142
                        return res;
1122
1143
                case 'B': /* Copy out command began successfully */
 
1144
            if (res)
 
1145
                QR_Destructor(res);
1123
1146
                        res = QR_Constructor();
1124
1147
                        QR_set_status(res, PGRES_COPY_OUT);
1125
1148
                        return res;
1129
1152
                        CC_set_no_trans(self);
1130
1153
 
1131
1154
                        mylog("send_query: error - %s\n", self->errormsg);
 
1155
            if (res)
 
1156
                QR_Destructor(res);
1132
1157
                        return NULL;
1133
1158
                }
1134
1159
        }