Fetch rows from OraQuery

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Fetch rows from OraQuery

Post by sinys » Fri 10 Aug 2012 08:21

OraQuery1.FetchAll := False;
OraQuery1.FetchRows := 25;
OraQuery1.Open;

How send command fetch next rows for OraQuery? (without OraQuery1.Next because they have blocked dbgrid fro user) Like MemTableEh1.FetchRecords(100) or MemTableEh1.FetchRecords(-1) (for fetch all records)

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Fetch rows from OraQuery

Post by AlexP » Fri 10 Aug 2012 10:57

hello,

To retrieve the next piece of data, you can use the MoveBy method

Code: Select all

OraQuery1.MoveBy(OraQuery1.FetchRows);

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: Fetch rows from OraQuery

Post by sinys » Fri 10 Aug 2012 12:04

But this command move current recno and that change dbgrid state if then state in dsinsert/dsedit (it's problem for DisableControls - save recno - move - load recno - EnableControls) it will prevent the user.

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: Fetch rows from OraQuery

Post by sinys » Sat 11 Aug 2012 06:54

1) Is there any way for local sorting in TOraQuery without fetch all records? (and without dbgrid functions)

2) I try using MemTableEh for local sorting but content your hack field types (ftBFile, ftLabel, ftOraTimeStamp, ftIntervalYM , ftIntervalDS, ftOraTimeStampTZ, ftOraTimeStampLTZ, ftNumber, ftXML) in TOraQuery prevents this.
How I can help MemTableEh understand this datatypes?

3)
for i := 0 to DBGridEh1.Columns.Count - 1 do
DBGridEh1.Columns.Field.DataType // return out of bound data type

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Fetch rows from OraQuery

Post by AlexP » Mon 13 Aug 2012 09:12

hello,

In TMemTableEh there is a data retrieving engine implemented different from the one that is implemented in our components, therefore there is no method similar to FetchRecords, with using of which the cursor doesn't move by the DataSet when retrieving the new data.

For filtering data we retrive all the records from the table, therefore it is impossible to use a filter without retrieving of all the data in our components.

To have an ability to work with such types, you should use Data Type Mapping, i.e. map our inner types to Delph types. You can find the detailed information and samples of Data Type Mapping in the help. For example, for ftOraTimeStamp you can use the following rule:

Code: Select all

OraQuery1.DataTypeMap.AddDBTypeRule(oraTimeStamp, ftTimeStamp);
or set this rule in the OraQuery dialog on the Data Type Mapping tab, specifying in the DataBase field the type and Field Type values of TimeStamp

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: Fetch rows from OraQuery

Post by sinys » Tue 14 Aug 2012 03:57

I'm try

// raise error Unsupported field type: 41.
OraQuery1.DataTypeMap.AddDBTypeRule(ftIntervalDS, ftOraInterval);

// Unsupported database type: 100.
OraQuery1.DataTypeMap.AddDBTypeRule(ftBFile, ftBlob);

How to do right?

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: Fetch rows from OraQuery

Post by sinys » Tue 14 Aug 2012 05:41

May be you add capability local sorting and filtering only for fetched rows?

Or may be it's possible if connect TVirtualTable? (but I have not found a way to)
Last edited by sinys on Tue 14 Aug 2012 09:20, edited 1 time in total.

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: Fetch rows from OraQuery

Post by sinys » Tue 14 Aug 2012 08:17

Code: Select all

OraQuery1.DataTypeMap.AddDBTypeRule(oraBFile, ftBlob); // Unsupported field type: 15
OraQuery1.DataTypeMap.AddDBTypeRule(oraBFile, ftOraBlob); // Unsupported field type: 30

Code: Select all

OraQuery1.DataTypeMap.AddDBTypeRule(oraBFile, ftVarBytes);
OraQuery1.Open; // Unsupported data type mapping: "BFile" to "VarBytes"
How to do right?

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: Fetch rows from OraQuery

Post by sinys » Tue 14 Aug 2012 08:37

Please show example for BFile and XML data types!

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Fetch rows from OraQuery

Post by AlexP » Tue 14 Aug 2012 12:28

hello,

In the AddDBTypeRule, the first parameter should be one of the following our inner field types:
oraChar, oraVarchar2, oraNChar, oraNVarchar2, oraNumber, oraBinaryFloat, oraBinaryDouble, oraDate, oraTimeStamp, oraTimeStampWithTimeZone,
oraTimeStampWithLocalTimeZone, oraBlob, oraClob, oraNClob, oraBFile, oraLong, oraRaw, oraLongRaw, oraRowID, oraURowID; that are declared in the OraDataTypeMap module.
The second parameter - one of the Delphi field types declared in the DB module in TFieldType.

If you are loading data from the DataSet in VirtualTable with the help of the Assign method, all the data from the DB will be loaded, independing on the settings of FetchAll of the used DataSet. Therefore sorting in VirtualTable will occur by all the data.

At the moment, mapping of such Oracle types as XMLTYPE and BFfile is not implemented, we review the possibility of adding such feature in one of the next versions.

Post Reply