~ubuntu-branches/ubuntu/wily/grass/wily

« back to all changes in this revision

Viewing changes to db/drivers/odbc/table.c

Tags: 7.0.0~rc1+ds1-1~exp1
* New upstream release candidate.
* Repack upstream tarball, remove precompiled Python objects.
* Add upstream metadata.
* Update gbp.conf and Vcs-Git URL to use the experimental branch.
* Update watch file for GRASS 7.0.
* Drop build dependencies for Tcl/Tk, add build dependencies:
  python-numpy, libnetcdf-dev, netcdf-bin, libblas-dev, liblapack-dev
* Update Vcs-Browser URL to use cgit instead of gitweb.
* Update paths to use grass70.
* Add configure options: --with-netcdf, --with-blas, --with-lapack,
  remove --with-tcltk-includes.
* Update patches for GRASS 7.
* Update copyright file, changes:
  - Update copyright years
  - Group files by license
  - Remove unused license sections
* Add patches for various typos.
* Fix desktop file with patch instead of d/rules.
* Use minimal dh rules.
* Bump Standards-Version to 3.9.6, no changes.
* Use dpkg-maintscript-helper to replace directories with symlinks.
  (closes: #776349)
* Update my email to use @debian.org address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
#include <string.h>
18
18
#include <grass/dbmi.h>
19
19
#include <grass/gis.h>
 
20
#include <grass/glocale.h>
20
21
#include "odbc.h"
21
22
#include "globals.h"
22
23
#include "proto.h"
127
128
    cursor *c;
128
129
    SQLRETURN ret;
129
130
    char msg[OD_MSG];
130
 
    char *emsg = NULL;
131
131
    SQLINTEGER err;
132
132
    SQLCHAR ttype[50], *tname;
133
133
    SQLINTEGER nrow = 0;
142
142
 
143
143
    ret = SQLTables(c->stmt, NULL, 0, NULL, 0, tname, sizeof(tname), NULL, 0);
144
144
    if ((ret != SQL_SUCCESS) && (ret != SQL_SUCCESS_WITH_INFO)) {
145
 
        report_error("SQLTables()");
 
145
        db_d_append_error("SQLTables()");
 
146
        db_d_report_error();
146
147
        return DB_FAILED;
147
148
    }
148
149
 
149
150
    /* Get number of rows */
150
151
    ret = SQLRowCount(c->stmt, &nrow);
151
152
    if ((ret != SQL_SUCCESS) && (ret != SQL_SUCCESS_WITH_INFO)) {
152
 
        report_error("SQLRowCount()");
 
153
        db_d_append_error("SQLRowCount()");
 
154
        db_d_report_error();
153
155
        return DB_FAILED;
154
156
    }
155
157
 
156
158
    if (nrow == 0) {
157
 
        G_asprintf(&emsg, "Table %s doesn't exist\n", tname);
158
 
        report_error(emsg);
159
 
        G_free(emsg);
 
159
        db_d_append_error(_("Table %s doesn't exist"), tname);
 
160
        db_d_report_error();
 
161
        
160
162
 
161
163
        return DB_FAILED;
162
164
    }
171
173
        sprintf(cmd, "DROP VIEW %s", tname);
172
174
    }
173
175
    else {
174
 
        G_asprintf(&emsg, "Table %s isn't 'TABLE' or 'VIEW' but %s\n", tname,
175
 
                   ttype);
176
 
        report_error(emsg);
177
 
        G_free(emsg);
178
 
 
 
176
        db_d_append_error(_("Table %s isn't 'TABLE' or 'VIEW' but %s"),
 
177
                          tname, ttype);
 
178
        db_d_report_error();
 
179
        
179
180
        return DB_FAILED;
180
181
    }
181
182
 
185
186
    if ((ret != SQL_SUCCESS) && (ret != SQL_SUCCESS_WITH_INFO)) {
186
187
        SQLGetDiagRec(SQL_HANDLE_STMT, c->stmt, 1, NULL, &err, msg,
187
188
                      sizeof(msg), NULL);
188
 
        G_asprintf(&emsg, "SQLExecDirect():\n%s\n%s (%d)\n", cmd, msg,
189
 
                   (int)err);
190
 
        report_error(emsg);
191
 
        G_free(emsg);
192
 
 
 
189
        db_d_append_error("SQLExecDirect():\n%s\n%s (%d)", cmd, msg,
 
190
                          (int)err);
 
191
        db_d_report_error();
 
192
        
193
193
        return DB_FAILED;
194
194
    }
195
195