[Oledb-dev] Provider question
Shachar Shemesh
psql at shemesh.biz
Mon Apr 10 06:54:20 GMT 2006
Arvo wrote:
>Hello Shachar,
>
>
>>I will, as soon as I have the patience to fire up my vmware again. I do
>>not run Windows on any real machine of mine.
>>
>>
>
>This explains many things :)
>
Does it?? :-O
Hmm, what exactly?
>Well, I'll try to make driver compile better. First on VS2002, then probably will install VS2005.
>
>
Just a word of advice. Putting casts any where the compiler complains is
easy. The difficult part is understanding whether the cast is dangerous,
and whether the cast should be skipped in favor of changing the return
code of the function.
>
>>>statreg.cpp is obsolete. Please remove it from your project.
>>>atlimpl.cpp is obsolete. Please remove it from your project.
>>>
>>>
>>>
>>>
>>Do you have any idea what these messages mean?
>>
>>
>
>Yes, for me they mean that postgresql 8.0.1 is obsolete :)) Using PG 8.1.3 (current stable) these errors disappeared.
>
>
I highly doubt that postgres is using atlimpl.cpp. Let me know how it
works, however :-).
>>>Compiling...
>>>
>>>
Some examples of the above amnious warning from above:
>>>TypeInfo.cpp
>>>e:\PGOLEDB\oledb\TypeInfo.cpp(32) : warning C4244: '=' : conversion from 'const __int64' to 'int', possible loss of data
>>>
>>>
>>If memory servs me right, this code was copied from Postgresql itself. I
>>wonder how it functions there.
>>
>>
>
>I think that not any better. Maybe PG source tree has some warnings turned off. I think I can just cast results to appropriate types - after some code investigation of course.
>
>
This is one place where, at least in some of the cases, it would be
better to change variable types.
>Some ideas to make some warnings (including in atldb.h) disappear:
>
>PgRs.h, line 73+:
>
> size_t GetCount() const
> {
> return GetSize();
> }
>
>
>
I'm assuming you meant changing the GetSize return type as well....
GetCount/GetSize is not a function which is our idea. It is mandated by
the ATL template we use. Before changing its return type, we need to
find out:
1. Is the function documented in MSDN, and if so, what return type is
listed for it?
2. If not (as I suspect is the case here), where is it used, and will
changing the type from signed to unsigned not cause false compares under
some situations.
3. Is there a legitimate case in which we WANT negative return values?
Error conditions is one case that comes to mind.
>(maybe size_t isn't the best type? smtg unsigned would be necessary)
>
>
What is the type of the variable we compare WITH? Generally, I like
size_t because it's a type designed to hold sizes of things.
>TypeInfo.cpp, line 240+:
>
>{
> ATLASSERT(count>=(size_t)GetWidth_string( sess, res, tup_num, field_num ));
> int reslen=PQgetlength( res, tup_num, field_num );
>
>
GetWidth_string is a function who's interface we defined. We do not need
to follow any external protocol with it. However, the question about
reserved negative returns still holds.
>TypeInfo.cpp, line 341+:
>
> void dump( BYTE *mem, size_t num ) {
> size_t i;
> for( i=0; i<num && i<(numshorts*2); ++i )
>
>
This one seems harmless enough.
>More to follow, maybe tomorrow :)
>
>
That is why I said I will need the machine up and some time for fixing
these :-) Feel free to send a patch, though.
Shachar
More information about the Oledb-devel
mailing list