[PATCH] VMS build update and freebcp nit (was Re: [freetds] 0.63
Release Candidate 9)
Craig A. Berry
craigberry at mac.com
Sat Jan 15 18:32:47 EST 2005
I apologize for the lateness of this. In the attached patch, there are a
couple of minor VMS-specific changes, and a small change to freebcp,
without which I don't think it will work at all on any platform. Here
are the three changes:
-- Improve non-tty handling in vms/getpass.c
-- Workaround for MMS build utility confusing foo/bar.c with foo/baz/bar.c
-- src/apps/freebcp.c tried to get column count after the structure that
holds it has already been freed and reinitialized.
The VMS-specific changes could wait for 0.64 if I'm the only one holding
up the release. On the other hand, they pose no risk to other platforms
and they test out ok on VMS.
I think the freebcp issue renders it unuseable, at least with TDS 7.0,
which is what I was testing with. Each call to dbresults() wipes out the
tds-level data, so you have to get the contents of
tds->res_info->num_cols into the dblib structures immediately after the
relevant dbresults() call, not two or three calls later as was happening
before my patch.
-------------- next part --------------
--- vms/descrip_mms.template;-0 Thu Dec 2 00:20:50 2004
+++ vms/descrip_mms.template Sat Jan 15 12:50:01 2005
@@ -235,8 +235,14 @@
[.src.tds]convert$(OBJ) : [.src.tds]convert.c
+[.src.tds]data$(OBJ) : [.src.tds]data.c
+
+[.src.dblib]bcp$(OBJ) : [.src.dblib]bcp.c
+
[.src.dblib]rpc$(OBJ) : [.src.dblib]rpc.c
+[.src.odbc]error$(OBJ) : [.src.odbc]error.c
+
[.src.tds]login$(OBJ) : [.src.tds]login.c
[.src.server]login$(OBJ) : [.src.server]login.c
--- vms/getpass.c;-0 Tue May 20 06:36:34 2003
+++ vms/getpass.c Sat Jan 15 12:30:14 2005
@@ -109,9 +109,10 @@
dvi_item = DVI$_DEVCLASS;
status = LIB$GETDVI(&dvi_item, 0, &ttdsc, &ttdevclass);
if (!$VMS_STATUS_SUCCESS(status)) {
- errno = EVMSERR;
- vaxc$errno = status;
- return NULL;
+ /* We might fail for perfectly good reasons, like
+ * SYS$COMMAND is not a device.
+ */
+ ttdevclass = 0;
}
/*
--- src/apps/freebcp.c;-0 Fri Nov 19 09:42:05 2004
+++ src/apps/freebcp.c Sat Jan 15 16:35:37 2005
@@ -521,6 +521,7 @@
DBINT li_rowsread = 0;
int i;
int li_numcols = 0;
+ RETCODE ret_code = 0;
if (dir == DB_QUERYOUT) {
if (dbfcmd(dbproc, "SET FMTONLY ON %s SET FMTONLY OFF", pdata->dbobject) == FAIL) {
@@ -539,9 +540,13 @@
return FALSE;
}
- while (NO_MORE_RESULTS != dbresults(dbproc));
+ while (NO_MORE_RESULTS != (ret_code = dbresults(dbproc))) {
+ if (ret_code == SUCCEED && li_numcols == 0) {
+ li_numcols = dbnumcols(dbproc);
+ }
+ }
- if (0 == (li_numcols = dbnumcols(dbproc))) {
+ if (0 == li_numcols) {
printf("Error in dbnumcols\n");
return FALSE;
}
@@ -611,6 +616,7 @@
int li_numcols = 0;
int li_coltype;
int li_collen;
+ RETCODE ret_code = 0;
if (dir == DB_QUERYOUT) {
if (dbfcmd(dbproc, "SET FMTONLY ON %s SET FMTONLY OFF", pdata->dbobject) == FAIL) {
@@ -629,9 +635,13 @@
return FALSE;
}
- while (NO_MORE_RESULTS != dbresults(dbproc));
+ while (NO_MORE_RESULTS != (ret_code = dbresults(dbproc))) {
+ if (ret_code == SUCCEED && li_numcols == 0) {
+ li_numcols = dbnumcols(dbproc);
+ }
+ }
- if (0 == (li_numcols = dbnumcols(dbproc))) {
+ if (0 == li_numcols) {
printf("Error in dbnumcols\n");
return FALSE;
}
More information about the FreeTDS
mailing list