<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -246,8 +246,8 @@ create_name_map(Cursor* cur, SQLSMALLINT field_count, bool lower)
     {
         SQLCHAR name[300];
         SQLSMALLINT nDataType;
-        SQLULEN nColSize;
-        SQLSMALLINT cDecimalDigits;
+        SQLULEN nColSize;           // precision
+        SQLSMALLINT cDecimalDigits; // scale
         SQLSMALLINT nullable;
 
         Py_BEGIN_ALLOW_THREADS
@@ -312,14 +312,14 @@ create_name_map(Cursor* cur, SQLSMALLINT field_count, bool lower)
             }
         }
         
-        colinfo = Py_BuildValue(&quot;(sOOiOOO)&quot;,
+        colinfo = Py_BuildValue(&quot;(sOOiiiO)&quot;,
                                 (char*)name,
-                                type,          // type_code
-                                Py_None,       // display size
-                                (int)nColSize, // internal_size
-                                Py_None,       // precision
-                                Py_None,       // scale
-                                nullable_obj); // null_ok
+                                type,           // type_code
+                                Py_None,        // display size
+                                (int)nColSize,  // internal_size
+                                nColSize,       // precision
+                                cDecimalDigits, // scale
+                                nullable_obj);  // null_ok
         if (!colinfo)
             goto done;
 </diff>
      <filename>src/cursor.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -745,6 +745,7 @@ class SqlServerTestCase(unittest.TestCase):
         self.cursor.execute(&quot;insert into t1 values(1, 'abc')&quot;)
 
         row = self.cursor.execute(&quot;select * from t1&quot;).fetchone()
+
         self.assertEquals(self.cursor.description, row.cursor_description)
         
 
@@ -995,8 +996,40 @@ class SqlServerTestCase(unittest.TestCase):
         self.cursor.execute(&quot;create table t2(n int, s varchar(10))&quot;)
         self.cursor.executemany(&quot;insert into t2 values (?, ?)&quot;, rows)
         
+    def test_description(self):
+        &quot;Ensure cursor.description is correct&quot;
+
+        self.cursor.execute(&quot;create table t1(n int, s varchar(8), d decimal(5,2))&quot;)
+        self.cursor.execute(&quot;insert into t1 values (1, 'abc', '1.23')&quot;)
+        self.cursor.execute(&quot;select * from t1&quot;)
 
+        # (I'm not sure the precision of an int is constant across different versions, bits, so I'm hand checking the
+        # items I do know.
+
+        # int
+        t = self.cursor.description[0]
+        self.assertEqual(t[0], 'n')
+        self.assertEqual(t[1], int)
+        self.assertEqual(t[5], 0)       # scale
+        self.assertEqual(t[6], True)    # nullable
+
+        # varchar(8)
+        t = self.cursor.description[1]
+        self.assertEqual(t[0], 's')
+        self.assertEqual(t[1], str)
+        self.assertEqual(t[4], 8)       # precision
+        self.assertEqual(t[5], 0)       # scale
+        self.assertEqual(t[6], True)    # nullable
+
+        # decimal(5, 2)
+        t = self.cursor.description[2]
+        self.assertEqual(t[0], 'd')
+        self.assertEqual(t[1], Decimal)
+        self.assertEqual(t[4], 5)       # precision
+        self.assertEqual(t[5], 2)       # scale
+        self.assertEqual(t[6], True)    # nullable
 
+        
 def main():
     from optparse import OptionParser
     parser = OptionParser(usage=usage)</diff>
      <filename>tests/sqlservertests.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>10ac782c60f8aa92c401963ca363d20f03de0a3e</id>
    </parent>
  </parents>
  <author>
    <name>Michael Kleehammer</name>
    <email>michael@kleehammer.com</email>
  </author>
  <url>http://github.com/mkleehammer/pyodbc/commit/ea32488a034a22b69b84ef60ad266803dc1b919b</url>
  <id>ea32488a034a22b69b84ef60ad266803dc1b919b</id>
  <committed-date>2009-09-05T10:20:01-07:00</committed-date>
  <authored-date>2009-09-05T10:20:01-07:00</authored-date>
  <message>Issue 67: Populate more elements of Cursor.description</message>
  <tree>d2845819756ca28ff9647665b4a20ded64235835</tree>
  <committer>
    <name>Michael Kleehammer</name>
    <email>michael@kleehammer.com</email>
  </committer>
</commit>
