[PATCH] support column size for SYBDATETIMN

"Craig A. Berry" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
I noticed with fisql recently that when selecting datetime columns the  
column width for display was not getting calculated correctly.  It  
turns out none of the various implementations of get_printable_size()  
was handling columns of SYBDATETIMN type, though we were handling  
other datetime types.  The attached patch simply adds SYDATETIMN to  
the list in the three relevant places I could find.

I believe this will correct the problem reported here:

<http://lists.ibiblio.org/pipermail/freetds/2010q2/025734.html>

though no guarantees.

Three files affected:

% lsdiff -s --strip=1 004_sybdatetimn_col_size.patch
! src/apps/bsqldb.c
! src/apps/fisql/fisql.c
! src/dblib/dblib.c


________________________________________
Craig A. Berry
mailto:[email protected]

"... getting out of a sonnet is much more
  difficult than getting in."
                  Brad Leithauser

_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
004_sybdatetimn_col_size.patch (application/octet-stream, 1.3 KB)
# HG changeset patch
# User BERRYC
# Date 1274288646 18000
# Node ID 7852a62d7a9ad90ae34236165b9bef6af7de7080
# Parent  f26d4177ca2f98fd88b2337b00f00e57f50bbd9c
Handle column size for SYBDATETIMN data type.

diff -r f26d4177ca2f -r 7852a62d7a9a src/apps/bsqldb.c
--- a/src/apps/bsqldb.c	Wed May 19 12:03:05 2010 -0500
+++ b/src/apps/bsqldb.c	Wed May 19 12:04:06 2010 -0500
@@ -691,6 +691,8 @@
 		return 26;	/* FIX ME */
 	case SYBDATETIME4:
 		return 26;	/* FIX ME */
+	case SYBDATETIMN:
+		return 26;	/* FIX ME */
 #if 0	/* not exported by sybdb.h */
 	case SYBBITN:
 	case SYBLONGBINARY:
diff -r f26d4177ca2f -r 7852a62d7a9a src/apps/fisql/fisql.c
--- a/src/apps/fisql/fisql.c	Wed May 19 12:03:05 2010 -0500
+++ b/src/apps/fisql/fisql.c	Wed May 19 12:04:06 2010 -0500
@@ -178,6 +178,8 @@
 		return 26;	/* FIX ME */
 	case SYBDATETIME4:
 		return 26;	/* FIX ME */
+	case SYBDATETIMN:
+		return 26;	/* FIX ME */
 #if 0				/* seems not to be exported to sybdb.h */
 	case SYBBITN:
 #endif
diff -r f26d4177ca2f -r 7852a62d7a9a src/dblib/dblib.c
--- a/src/dblib/dblib.c	Wed May 19 12:03:05 2010 -0500
+++ b/src/dblib/dblib.c	Wed May 19 12:04:06 2010 -0500
@@ -3556,6 +3556,7 @@
 		return 12;
 	case SYBDATETIME:
 	case SYBDATETIME4:
+	case SYBDATETIMN:
 		return 26;
 	case SYBUNIQUE:
 		return 36;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.