Hello!
I am using DOA's Object Extension with Delphi7 to manipulate objects returned by a select command in a TOracleQuery component.
After this component buffered some data, and while this data was being manipulated by the application, I noticed some network traffic.
Using a sniffer software, I saw that, for each object, every first reading made to any of its enbedded objects triggered an access to the database (querying for the structure of the object, I believe). This seems to happen when I use the TOracleObject.ObjAttr method.
I didn't expect this extra network traffic, because I thought that the entire object structure was sent once and only once to the application.
Am I doing something wrong (or anything right)?
This is a dummy example of the kind of thing I am trying to do:
CREATE TYPE Address_Typ AS OBJECT (
street VARCHAR2(30),
city VARCHAR2(30))
/
CREATE TYPE Address_Tab AS TABLE OF Address_Typ
/
CREATE TYPE Person_Typ AS OBJECT (
name VARCHAR2(30),
addresses Address_Tab)
/
-- just to provide some data...
CREATE TABLE persons (
name VARCHAR2(30),
street1 VARCHAR2(30),
city1 VARCHAR2(30),
street2 VARCHAR2(30),
city2 VARCHAR2(30))
/
BEGIN
FOR i IN 1..100 LOOP
INSERT INTO persons VALUES ('ABCDE','GHIJKL','MNOPQ','RSTU','VWXYZ');
END LOOP;
END;
/
COMMIT
/
In Delphi:
var
i: Integer;
Street: String;
begin
With TOracleQuery.Create(nil) do
try
Session := MySession;
SQL.Text := 'SELECT Person_Typ(name,Address_Tab(Address_Typ(street1,city1),Address_Typ(street2,city2))) AS person FROM persons';
Execute;
While not Eof do
begin
{the first execution of the following line, for each record, causes network traffic}
for i := 0 to ObjField('person').ObjAttr('addresses').ElementCount-1 do
Street := ObjField('person').ObjAttr('addresses').GetAttr('street');
Next;
end;
finally
Free;
end;
end;
Thanks in advance!
I am using DOA's Object Extension with Delphi7 to manipulate objects returned by a select command in a TOracleQuery component.
After this component buffered some data, and while this data was being manipulated by the application, I noticed some network traffic.
Using a sniffer software, I saw that, for each object, every first reading made to any of its enbedded objects triggered an access to the database (querying for the structure of the object, I believe). This seems to happen when I use the TOracleObject.ObjAttr method.
I didn't expect this extra network traffic, because I thought that the entire object structure was sent once and only once to the application.
Am I doing something wrong (or anything right)?
This is a dummy example of the kind of thing I am trying to do:
CREATE TYPE Address_Typ AS OBJECT (
street VARCHAR2(30),
city VARCHAR2(30))
/
CREATE TYPE Address_Tab AS TABLE OF Address_Typ
/
CREATE TYPE Person_Typ AS OBJECT (
name VARCHAR2(30),
addresses Address_Tab)
/
-- just to provide some data...
CREATE TABLE persons (
name VARCHAR2(30),
street1 VARCHAR2(30),
city1 VARCHAR2(30),
street2 VARCHAR2(30),
city2 VARCHAR2(30))
/
BEGIN
FOR i IN 1..100 LOOP
INSERT INTO persons VALUES ('ABCDE','GHIJKL','MNOPQ','RSTU','VWXYZ');
END LOOP;
END;
/
COMMIT
/
In Delphi:
var
i: Integer;
Street: String;
begin
With TOracleQuery.Create(nil) do
try
Session := MySession;
SQL.Text := 'SELECT Person_Typ(name,Address_Tab(Address_Typ(street1,city1),Address_Typ(street2,city2))) AS person FROM persons';
Execute;
While not Eof do
begin
{the first execution of the following line, for each record, causes network traffic}
for i := 0 to ObjField('person').ObjAttr('addresses').ElementCount-1 do
Street := ObjField('person').ObjAttr('addresses').GetAttr('street');
Next;
end;
finally
Free;
end;
end;
Thanks in advance!