[fdo-internals] FDO documentation questions
Haris Kurtagic
haris at sl-king.com
Fri May 16 12:02:57 EDT 2008
Sorry for late response. This is code from Fdo2Fdo for batch copy.
BatchInsertSize is argument to procedure which is set by user in Fdo2Fdo
when he wants to use batch copy.
FdoPtr<FdoBatchParameterValueCollection> batch_paramval_col =
inscomm->GetBatchParameterValues();
if( (BatchInsertSize > 1) && batch_paramval_col.p )
{
// prepare parameters values in property v
int propcount = insprop_col->GetCount();
for(int ind=0; ind<propcount;ind++)
{
FdoPtr<FdoPropertyValue> propval = insprop_col->GetItem(ind);
FdoPropertyDefinition* source_prop =
source_insprop_vector.at(ind);
FdoPropertyDefinition* dest_prop = dest_insprop_vector.at(ind);
FdoPtr<FdoParameter> param = FdoParameter::Create(
dest_prop->GetName() );
propval->SetValue(param.p);
}
// now read source features and add to parameter values
int batchrownum=0;
while(freader->ReadNext())
{
// read properties of source classdef
FdoPtr<FdoParameterValueCollection> paramval_col =
FdoParameterValueCollection::Create();
for(int ind=0; ind<propcount;ind++)
{
FdoPtr<FdoPropertyValue> propval = insprop_col->GetItem(ind);
FdoPropertyDefinition* source_prop =
source_insprop_vector.at(ind);
FdoPropertyDefinition* dest_prop = dest_insprop_vector.at(ind);
switch( dest_prop->GetPropertyType() )
{
case FdoPropertyType_GeometricProperty:
{
FdoPtr<FdoGeometryValue> geomval = FdoGeometryValue::Create(
freader->GetGeometry(source_prop->GetName()) );
paramval_col->Add(
FdoParameterValue::Create(dest_prop->GetName(),geomval) );
}
break;
case FdoPropertyType_DataProperty:
{
FdoDataPropertyDefinition* dest_dataprop =
(FdoDataPropertyDefinition*)dest_prop;
FdoDataPropertyDefinition* source_dataprop =
(FdoDataPropertyDefinition*)source_prop;
FdoPtr<FdoDataValue> dval =
c_FDO_Api::ReaderGetDataPropertyValue(freader,source_prop->GetName(),sou
rce_dataprop->GetDataType(),dest_dataprop->GetDataType());
paramval_col->Add(
FdoParameterValue::Create(dest_dataprop->GetName(),dval) );
}
break;
}
}
batch_paramval_col->Add(paramval_col);
batchrownum++;
if( batchrownum >= BatchInsertSize )
{
// start execute
inscomm->Execute();
numcopied += batchrownum;
batch_paramval_col->Clear();
batchrownum = 0;
}
}
// check if soem features are left beacuse reader finished and some
are still in batch collection
if( batchrownum > 0 )
{
// now insert the last one records
inscomm->Execute();
numcopied += batchrownum;
batch_paramval_col->Clear();
batchrownum = 0;
}
From: fdo-internals-bounces at lists.osgeo.org
[mailto:fdo-internals-bounces at lists.osgeo.org] On Behalf Of Donald
Cameron
Sent: Friday, May 02, 2008 8:32 PM
To: 'FDO Internals Mail List'
Subject: RE: [fdo-internals] FDO documentation questions
Thanks Haris,
I apologize for the delay in replying. I forgot I was funneling
fdo-internals into another email box.
I look forward to seeing the sample code.
Don
From: fdo-internals-bounces at lists.osgeo.org
[mailto:fdo-internals-bounces at lists.osgeo.org] On Behalf Of Haris
Kurtagic
Sent: Thursday, May 01, 2008 1:24 PM
To: FDO Internals Mail List
Subject: RE: [fdo-internals] FDO documentation questions
King.Oracle is supporting batch insert. I remember testing it in Fdo2Fdo
when it makes a speed difference when copying data.
I will look into Fdo2Fdo code and give you and example.
Haris
From: fdo-internals-bounces at lists.osgeo.org
[mailto:fdo-internals-bounces at lists.osgeo.org] On Behalf Of Donald
Cameron
Sent: Thursday, May 01, 2008 3:59 PM
To: 'fdo-internals at lists.osgeo.org'
Subject: [fdo-internals] FDO documentation questions
Hi,
I am working on the FDO documentation: The Essential FDO, The FDO
Developers Guide, and the FDO API Reference.
I was going to write some sample code that does batch inserts using the
OSGeo.FDO.Commands.BatchParameterValueCollection property of the
OSGeo.FDO.Commands.Feature.IInsert command but I was told that no
providers support batch insertion.
I currently believe that the SupportsParameters() method of
OSGeo.FDO.Connections.Capabilities.ICommandCapabilities says whether a
provider supports batch inserts.
According to a program I wrote, three providers support parameters:
ArcSDE, KingOracle, and PostGIS.
So my question is this: Do they actually support batch insertion?
If so, I would be very grateful for some sample code showing how to use
BatchParameterValueCollection to do batch insertion.
Regards,
Don
Don Cameron
Autodesk Inc.
Developer Publications Specialist
Ottawa, Ontario, Canada
613.233.3758
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.524 / Virus Database: 269.23.7/1408 - Release Date:
4/30/2008 6:10 PM
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.524 / Virus Database: 269.23.7/1410 - Release Date:
5/1/2008 5:30 PM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/fdo-internals/attachments/20080516/c3e5dc67/attachment-0001.html
More information about the fdo-internals
mailing list