nSeconds=seconds() *********************************Part of your code . LOCAL cSchemaXML, cTempCursorName cTempCursorName = SYS(2015) oCollection = NEWOBJECT('Collection') SELECT * FROM (cCursor) WHERE RECNO() = 0 INTO CURSOR ( cTempCursorName ) CURSORTOXML(cTempCursorName ,'cSchemaXML',1,1,1,"1") nSeconds = seconds() - nSeconds &&my insertion . . *********************************nSeconds = ???
oCollection = cursor2collection('cAlias','cKeyField')>1st run = 1.266 seconds
collection2cursor(oCollection, 'cAlias')
>>PROCEDURE cursor2collection( cCursor, cKeyField ) >#DEFINE trimCharColumns .F. > >_t = SECONDS() > >LOCAL cSchemaXML, cTempCursorName >cTempCursorName = SYS(2015) >oCollection = NEWOBJECT('Collection') >SELECT * FROM (cCursor) WHERE RECNO() = 0 INTO CURSOR ( cTempCursorName ) >CURSORTOXML(cTempCursorName ,'cSchemaXML',1,1,1,"1") >ADDPROPERTY(oCollection,'CursorSchema',cSchemaXML) >oCharColumnsCol = NEWOBJECT('Collection') >SELECT (cCursor) >i=0 >iFieldCount = AFIELDS(aFlds) >FOR c=1 TO iFieldCount > IF TYPE(aFlds[c,1]) $ 'C,M' > oCharColumnsCol.Add(aFlds[c,1]) > ENDIF >NEXT > >i=0 >SCAN > i = i + 1 > oCollection.Add(NEWOBJECT('Empty'),TRIM(EVALUATE(cKeyField))) > oObj = oCollection.Item(i) > SCATTER NAME oObj ADDITIVE > IF trimCharColumns > FOR c=1 to oCharColumnsCol.Count > cFldName = oCharColumnsCol.Item(c) > oObj.&cFldName = TRIM(oObj.&cFldName) > NEXT > ENDIF >ENDSCAN >?'Cursor 2collection',SECONDS() - _t, ' sec' >RETURN oCollection > > > >**************************************************** >PROCEDURE collection2cursor(oCollection,cCursorname) > >_t = SECONDS() > >LOCAL oRow,i >XMLTOCURSOR(oCollection.CursorSchema,cCursorname) >SELECT (cCursorName) >FOR i=1 TO oCollection.Count > oRow = oCollection.Item(i) > APPEND BLANK > GATHER NAME oRow >NEXT >?'Collection 2 cursor', SECONDS() - _t, ' sec' >>