问题描述
publicISCCollection[]loadObjects(ISCPreparableprep,Object[]values){intnumFields=prep.getFieldCount();//Createacollectionforeachfieldreturnedbythepreparedstatement[/color]ISCCollection[]objs=newISCCollection[numFields];for(inti=0;i<numFields;++i){objs[i]=(ISCCollection)m_mgr.newCollection();}//CollectionusedtostoreobjectswhichshouldbefaultedISCCollectionfaultObjs=(ISCCollection)m_mgr.newCollection();//ExecutethepreparedstatementISCRecordsetrs=m_query.execute(prep,values);//Iteratethroughtherowsintherecordsetwhile(rs.moveNext()){//ObjectaBackboneobjectforeachfieldintherecordsetrowfor(inti=0;i<numFields;++i){Objectvalue=rs.valueFromIndex(i);//ChecktoseeifthevalueisaGIDstringif(valueinstanceofString){//XXXWeareassumingthatthestringwillbeaGID//ObtaintheobjectshellISCObjectBaseobj=m_mgr.objectFromGID(m_mgr.newGID((String)value));//AddittothecollectionofobjectstobefaultedaddIgnoreDuplicates(faultObjs,obj);//AddittotheresultscollectionaddIgnoreDuplicates(objs[i],obj);}//Checktoseeifthisisanobjectelseif(valueinstanceofISCObjectBase){addIgnoreDuplicates(objs[i],(ISCObjectBase)value);}}}//Faultobjectsintomemoryonlyifnecessaryif(faultObjs.getCount()>0){faultObjs.Fault();}returnobjs;}/***Addtheobjecttothecollectionandignoretheduplicate*objectexceptionifitisthrown.*/privatevoidaddIgnoreDuplicates(ISCCollectioncol,ISCObjectBaseobj){try{col.add(obj);}catch(DuplicateObjectExceptiondupex){}}备注:ISCRecordset这些对象都是跟Java结果集差不多的!应该是循环影响吧,希望同志们能帮我改改,谢谢