您好,欢迎访问三七文档
当前位置:首页 > 建筑/环境 > 电气安装工程 > uaUtilityEnumRecords_1
#includeapdefap.hBOOLuaUtilityEnumRecords(constchar*pszArchiveName,constchar*lpszFilter,constchar*lpszSort,BOOL(UserFunc)(UAHARCHIVE*phUA,void*pUserData),void*pUserData){/*FunctioncreateaQueryforaUserArchivespecifiedbyFilterandsortcondition.FunctioncallsforeachRecordinQueryUserfunctionifFilterspecified.Ifnotfilterspezifiedfunctioncallsuserfunctiononlyonetime.ParameterhArchive:HandletoaUserArchivelpszFilter:PointertoZerroTerminatedstringwithFilterforUserArchive.IfPointeris'ntNULLfunctionmakenewQueryfromArchive,andcallsforEACHrecordUserFunction!IfPointerisNULL:FunctioncreateconectiontoUserArchivewhithoutfilter.InthisCaseuserfunctioniscalledonlyONETIME!!lpszSort:pointertozeroterminatedstringwithsortconditionlpFunc:PointertoUserFunction.pUserData:PointertoParameterStructforUserFunction.*/BOOLreturnCode=TRUE;constchar*funcName=uaUtilityEnumRecords;UAHCONNECThConnect;BOOLreturnCode=TRUE;//GetConnectiontoUserArchivesreturnCode=uaConnect(&hConnect);if(!returnCode||!hConnect){returnCode=FALSE;printf(%sfaultinuaConnect\r\n,funcName);}else{//GetHandletoActualArchive.UAHARCHIVEhArchive;if(!uaQueryArchiveByName(hConnect,pszArchiveName,&hArchive)){printf(%s:uaQueryArchiveError:%d\r\n,funcName,uaGetLastError());returnCode=FALSE;}else{if(lpszFilter)returnCode=uaArchiveSetFilter(hArchive,lpszFilter);if(lpszSort)returnCode=(returnCode&&uaArchiveSetSort(hArchive,lpszSort));if(!returnCode){printf(%s:uaArchiveSetFilter\r\n,funcName);}else{//OpenDatareturnedbyQueryif(uaArchiveOpen(hArchive)){//IfFilterspecified:GotoFirstRecordinQueryif(!lpszFilter)//ifnoneFilterspecified:calluserfunkctiononeTimeonly{if(!(returnCode=UserFunc(&hArchive,pUserData))){printf(%serrorinUserFuncion!!\r\n,funcName);}}else//Filterangegeben(Filterspecified){BOOLisRecord=uaArchiveMoveFirst(hArchive);//IfFilterspecified:ForeachRecordinQuery:iterateallRecordsandCallUserFunctionwhile(isRecord&&lpszFilter){if(!(returnCode=UserFunc(&hArchive,pUserData))){printf(%serrorinUserFuncion!!\r\n,funcName);}isRecord=uaArchiveMoveNext(hArchive);}//...while..}//if!Filterif(!uaArchiveClose(hArchive)){printf(%serrorinuaArchiveClose!\r\n,funcName);returnCode=FALSE;}}//uaArchiveOpen}//....SetFilterif(!uaReleaseArchive(hArchive)){printf(%serrorinuaReleaseArchive!\r\n,funcName);returnCode=FALSE;}}//uaQueryArchiveByNameif(!uaDisconnect(hConnect)){printf(%serrorinuaDisconnect!\r\n,funcName);returnCode=FALSE;}}//....if(!returnCode||!hConnect)returnreturnCode;}
本文标题:uaUtilityEnumRecords_1
链接地址:https://www.777doc.com/doc-5332915 .html