 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Karl Thompson Guest
|
Posted: Thu Sep 18, 2003 7:02 pm Post subject: Is this a D7 ADO Bug? |
|
|
Bear with me please. This has taken 5 days to track down.
Many problems, but the most signifigant one is an TADOTable is closed and
then in the next line of code, a call to its open method fails with this
error:
"Arguments are of the wrong type...."
In the ADODB unit, please take a look at this method if you are interested:
procedure TCustomADODataSet.OpenCursor(InfoQuery: Boolean);
the first few line are this:
begin
if not Assigned(Recordset) then
begin
InitializeConnection;
InitializeRecordset;
Recordset.Open(Source, ActiveConnection,
CursorTypeValues[FCursorType], LockTypeValues[FLockType],
Integer(CommandTypeValues[CommandType]) +
ExecuteOptionsToOrd(ExecuteOptions));
The failure occures in the RecordSet.Open.
When the table opens successfully, the value of the ActiveConnection
parameter is
Error(-2147352572)
When it fails the value is
'Unassigned'
I can trace the problem only as far as here:
procedure InitializeConnection;
The value of ActiveConnection is initialized with this line of code:
ActiveConnection := EmptyParam;
Now, interestinginly enough, EmptyParam is declared in unit Variants this
way:
var
EmptyParam: OleVariant; // "Empty parameter" standard constant which
can be
{$EXTERNALSYM EmptyParam} // passed as an optional parameter on a dual
// interface.
(You'll notice it's not a Constant, though the comment says it is.)
More importantly, what debug techniques can I use to find out how/when
EmptyParam gets set to 'Unassigned'?
For, if I reset the value of EmptyParam to Error(-2147352572) using the
integrated debugger, the table opens perfectly and all other problems go
away. Even the 'locate' works that had not been working.
Any ideas here?
TIA
(Sorry to be so long winded.)
|
|
| Back to top |
|
 |
Karl Thompson Guest
|
Posted: Thu Sep 18, 2003 9:39 pm Post subject: Re: Is this a D7 ADO Bug? Maybe a Bloomberg Bug? |
|
|
(There is a certain satisfaction of getting something to work after 5 days
of banging one's head against the ol' desk. One might wonder why it took 5
days. Well I'll tell you. This is my first ADO conversion. So I kept
thinking, I had a problem. [Maybe I do!])
Please read on (for a fix - but no understanding of whose problem it is)....
First, there are two global EmptyParam variants in the Delphi VCL code. One
in Variants.pas and the other in OleCtrls.pas.
The project is an application which interfaces to the Bloomberg data
service. It "subscibes" to data for particular securities and when data is
returned it writes it to fields for the particular security in an Access
database.
The interface to Bloomberg is provide via a COM object. The Type Library
(BLP_DATA_CTRLLib_TLB)
In the type library, there is this method:
procedure TBlpData.Subscribe(Security: OleVariant; cookie: Integer; Fields:
OleVariant);
begin
DefaultInterface.Subscribe(Security, cookie, Fields, EmptyParam,
EmptyParam, EmptyParam,
EmptyParam);
end;
The DefaultInterface is declared as:
property DefaultInterface: IBlpData4 read GetControlInterface;
and IBlpData4 as
IBlpData4 = interface(IDispatch)
Anyway, in the debugger, I attempt to trace the call to
DefaultInterface.Subscribe
the first press of [F7] takes me here to this little procedure in
VARIANTS.pas:
procedure _VarClr(var V: TVarData);
It is this 3 lines of assembly code that reinitializes the
Variants.EmptyParma to 'Unassigned'
Question, can someone tell me from the above Subscribe method's signature
why it takes me to the Variants._VarClr() procedure?
Finally, I'm wondering if _VarClr should be setting OleCtrls.EmptyParam to
'Unassigned' rather than Variants.Param. What do you think?
Oh, the fix. I call the Bloomberg COM object this way:
FblmControl.Subscribe( FSecurity, Cookie, FblmFields );
If I add these to lines immediately after the above, literally, everything
that did not work, works.
TVarData( Variants.EmptyParam ).VType := varError;
TVarData( Variants.EmptyParam ).VError := VAR_PARAMNOTFOUND;
Random errors such as:
"Row cannnot be located for updating. Some values may have been changed
since it was last read".
"Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another."
the Locate method always returning false
just all seem to go away. :-)
"Karl Thompson" <KarlThompson (AT) yahoo (DOT) com> wrote
| Quote: |
Bear with me please. This has taken 5 days to track down.
Many problems, but the most signifigant one is an TADOTable is closed and
then in the next line of code, a call to its open method fails with this
error:
"Arguments are of the wrong type...."
In the ADODB unit, please take a look at this method if you are
interested:
procedure TCustomADODataSet.OpenCursor(InfoQuery: Boolean);
the first few line are this:
begin
if not Assigned(Recordset) then
begin
InitializeConnection;
InitializeRecordset;
Recordset.Open(Source, ActiveConnection,
CursorTypeValues[FCursorType], LockTypeValues[FLockType],
Integer(CommandTypeValues[CommandType]) +
ExecuteOptionsToOrd(ExecuteOptions));
The failure occures in the RecordSet.Open.
When the table opens successfully, the value of the ActiveConnection
parameter is
Error(-2147352572)
When it fails the value is
'Unassigned'
I can trace the problem only as far as here:
procedure InitializeConnection;
The value of ActiveConnection is initialized with this line of code:
ActiveConnection := EmptyParam;
Now, interestinginly enough, EmptyParam is declared in unit Variants this
way:
var
EmptyParam: OleVariant; // "Empty parameter" standard constant which
can be
{$EXTERNALSYM EmptyParam} // passed as an optional parameter on a dual
// interface.
(You'll notice it's not a Constant, though the comment says it is.)
More importantly, what debug techniques can I use to find out how/when
EmptyParam gets set to 'Unassigned'?
For, if I reset the value of EmptyParam to Error(-2147352572) using the
integrated debugger, the table opens perfectly and all other problems go
away. Even the 'locate' works that had not been working.
Any ideas here?
TIA
(Sorry to be so long winded.)
|
|
|
| Back to top |
|
 |
Karl Thompson Guest
|
Posted: Thu Sep 18, 2003 9:48 pm Post subject: It appears to be a Borland problem.... |
|
|
The interface of this type library
unit BLP_DATA_CTRLLib_TLB;
has these declared
uses Windows, ActiveX, Classes, Graphics, OleCtrls, OleServer, StdVCL,
Variants;
Question:
If units OleCtrls.pas and Variants.pas have both declared 'EmptyParam'
globally, then which 'EmptyParam' is being passed in this method?
procedure TBlpData.Subscribe(Security: OleVariant; cookie: Integer; Fields:
OleVariant);
begin
DefaultInterface.Subscribe(Security, cookie, Fields, EmptyParam,
EmptyParam, EmptyParam,
EmptyParam);
end;
|
|
| Back to top |
|
 |
Bryan Valencia Guest
|
Posted: Sat Sep 20, 2003 12:58 am Post subject: Re: It appears to be a Borland problem.... |
|
|
Can you rightclick it in the editor and see where the IDE think it comes
from?
Alternately, set a breakpoint and check the value at runtime.
"Karl Thompson" <KarlThompson (AT) yahoo (DOT) com> wrote
| Quote: |
The interface of this type library
unit BLP_DATA_CTRLLib_TLB;
has these declared
uses Windows, ActiveX, Classes, Graphics, OleCtrls, OleServer, StdVCL,
Variants;
Question:
If units OleCtrls.pas and Variants.pas have both declared 'EmptyParam'
globally, then which 'EmptyParam' is being passed in this method?
procedure TBlpData.Subscribe(Security: OleVariant; cookie: Integer;
Fields:
OleVariant);
begin
DefaultInterface.Subscribe(Security, cookie, Fields, EmptyParam,
EmptyParam, EmptyParam,
EmptyParam);
end;
|
|
|
| Back to top |
|
 |
ozbear Guest
|
Posted: Sat Sep 20, 2003 11:00 pm Post subject: Re: It appears to be a Borland problem.... |
|
|
On Fri, 19 Sep 2003 21:50:06 -0500, Brian Bushay TeamB
<BBushay (AT) Nmpls (DOT) com> wrote:
| Quote: |
If units OleCtrls.pas and Variants.pas have both declared 'EmptyParam'
globally, then which 'EmptyParam' is being passed in this method?
Which ever unit is first in your USES clause
|
Err...don't you mean last?
Oz
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|