[Oledb-dev] bytea commits to PgRS.* files cause pgoledb to return uninitialized GetColumnInfo data

Victor Snezhko snezhko at indorsoft.ru
Thu Apr 20 10:18:23 UTC 2006


I should definitely fix my mail reader, for it doesn't set
Content-Type: text/plain header for text parts of multipart messages,
but for now I'll just send the patch copypasted, it's simple anyway.

Shachar Shemesh <psql at shemesh.biz> writes:

>>I'm trying to tweak pgoledb to work with Microsoft client cursor
>>engine (CCE) and have found a bug introduced by commits which add the
>>support of bytea.
>>
>>The following line has been added to PgRS.h:FillDataOffsets():
>>
>>         for( int i=0; i<nfields; ++i ) {
>>             rpInfo[i].cbOffset=m_offsets[i];
>>+            rpInfo[i].ulColumnSize=m_sizes[i];
>>         }
>>  
>>
> After some going over the code, and more specifically, over the specs,
> it seems that this line is just wrong, no matter how you look at it.
>
> I reverted this line in CVS. Thanks for the report.

I have one more patch (attached) to finish revert. It makes column
size initialized in TypeInfo.h:StatUnknown().

Without this patch ulColumnSize of integer (and some other) fields is
returned to be ~0.

-- 
WBR, Victor V. Snezhko
EMail: snezhko at indorsoft.ru


Index: TypeInfo.h
===================================================================
RCS file: /cvsroot/oledb/oledb/TypeInfo.h,v
retrieving revision 1.19
diff -u -r1.19 TypeInfo.h
--- TypeInfo.h	15 Apr 2006 11:39:41 -0000	1.19
+++ TypeInfo.h	17 Apr 2006 06:59:47 -0000
@@ -145,7 +145,7 @@
     static void StatUnknown(ATLCOLUMNINFO *colinfo, PGresult *res, int field_num)
     {
         colinfo->pTypeInfo=NULL;
-        colinfo->ulColumnSize=~0;
+        colinfo->ulColumnSize=PQfsize(res,field_num);
         if( colinfo->ulColumnSize<0 )
             colinfo->ulColumnSize=~0;
         colinfo->dwFlags=DBCOLUMNFLAGS_MAYBENULL|




More information about the Oledb-devel mailing list