10fbfc30aSopenharmony_ci/** 20fbfc30aSopenharmony_ci * @file Describe the file 30fbfc30aSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 40fbfc30aSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 50fbfc30aSopenharmony_ci * you may not use this file except in compliance with the License. 60fbfc30aSopenharmony_ci * You may obtain a copy of the License at 70fbfc30aSopenharmony_ci * 80fbfc30aSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 90fbfc30aSopenharmony_ci * 100fbfc30aSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 110fbfc30aSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 120fbfc30aSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 130fbfc30aSopenharmony_ci * See the License for the specific language governing permissions and 140fbfc30aSopenharmony_ci * limitations under the License. 150fbfc30aSopenharmony_ci */ 160fbfc30aSopenharmony_ci 170fbfc30aSopenharmony_ciimport data_rdb from '@ohos.data.relationalStore'; 180fbfc30aSopenharmony_ciimport { EventColumns } from './EventColumns'; 190fbfc30aSopenharmony_ci 200fbfc30aSopenharmony_ciinterface EventIndexesType { 210fbfc30aSopenharmony_ci idIndex: number; 220fbfc30aSopenharmony_ci syncIdIndex: number; 230fbfc30aSopenharmony_ci dirtyIndex: number; 240fbfc30aSopenharmony_ci mutatorsIndex: number; 250fbfc30aSopenharmony_ci calendarTypeIndex: number; 260fbfc30aSopenharmony_ci uuidIndex: number; 270fbfc30aSopenharmony_ci imageTypeIndex: number; 280fbfc30aSopenharmony_ci lastSyncedIndex: number; 290fbfc30aSopenharmony_ci calendarIdIndex: number; 300fbfc30aSopenharmony_ci titleIndex: number; 310fbfc30aSopenharmony_ci eventLocationIndex: number; 320fbfc30aSopenharmony_ci longitudeIndex: number; 330fbfc30aSopenharmony_ci latitudeIndex: number; 340fbfc30aSopenharmony_ci descriptionIndex: number; 350fbfc30aSopenharmony_ci eventColorIndex: number; 360fbfc30aSopenharmony_ci eventColorIndexIndex: number; 370fbfc30aSopenharmony_ci eventStatusIndex: number; 380fbfc30aSopenharmony_ci selfAttendeeStatusIndex: number; 390fbfc30aSopenharmony_ci dtStartIndex: number; 400fbfc30aSopenharmony_ci dtEndIndex: number; 410fbfc30aSopenharmony_ci eventTimeZoneIndex: number; 420fbfc30aSopenharmony_ci durationIndex: number; 430fbfc30aSopenharmony_ci allDayIndex: number; 440fbfc30aSopenharmony_ci accessLevelIndex: number; 450fbfc30aSopenharmony_ci availabilityIndex: number; 460fbfc30aSopenharmony_ci hasAlarmIndex: number; 470fbfc30aSopenharmony_ci hasExtendedPropertiesIndex: number; 480fbfc30aSopenharmony_ci rRuleIndex: number; 490fbfc30aSopenharmony_ci rDateIndex: number; 500fbfc30aSopenharmony_ci exRuleIndex: number; 510fbfc30aSopenharmony_ci exDateIndex: number; 520fbfc30aSopenharmony_ci originalIdIndex: number; 530fbfc30aSopenharmony_ci originalSyncIdIndex: number; 540fbfc30aSopenharmony_ci originalInstanceTimeIndex: number; 550fbfc30aSopenharmony_ci originalAllDayIndex: number; 560fbfc30aSopenharmony_ci lastDateIndex: number; 570fbfc30aSopenharmony_ci eventTimeStampIndex: number; 580fbfc30aSopenharmony_ci hasAttendeeDataIndex: number; 590fbfc30aSopenharmony_ci guestsCanModifyIndex: number; 600fbfc30aSopenharmony_ci guestsCanInviteOthersIndex: number; 610fbfc30aSopenharmony_ci guestsCanSeeGuestsIndex: number; 620fbfc30aSopenharmony_ci organizerIndex: number; 630fbfc30aSopenharmony_ci isOrganizerIndex: number; 640fbfc30aSopenharmony_ci deletedIndex: number; 650fbfc30aSopenharmony_ci eventEndTimezoneIndex: number; 660fbfc30aSopenharmony_ci customAppPackageIndex: number; 670fbfc30aSopenharmony_ci customAppUriIndex: number; 680fbfc30aSopenharmony_ci uid2445Index: number; 690fbfc30aSopenharmony_ci versionIndex: number; 700fbfc30aSopenharmony_ci eventUuidIndex: number; 710fbfc30aSopenharmony_ci hwExtAlertTypeIndex: number; 720fbfc30aSopenharmony_ci importantEventTypeIndex: number; 730fbfc30aSopenharmony_ci serviceVerifiedIndex: number; 740fbfc30aSopenharmony_ci serviceTypeIndex: number; 750fbfc30aSopenharmony_ci serviceCpBzUriIndex: number; 760fbfc30aSopenharmony_ci serviceCpMngUriIndex: number; 770fbfc30aSopenharmony_ci serviceDescriptionIndex: number; 780fbfc30aSopenharmony_ci serviceSupportMinVersionIndex: number; 790fbfc30aSopenharmony_ci syncData1Index: number; 800fbfc30aSopenharmony_ci syncData2Index: number; 810fbfc30aSopenharmony_ci syncData3Index: number; 820fbfc30aSopenharmony_ci syncData4Index: number; 830fbfc30aSopenharmony_ci syncData5Index: number; 840fbfc30aSopenharmony_ci syncData6Index: number; 850fbfc30aSopenharmony_ci syncData7Index: number; 860fbfc30aSopenharmony_ci syncData8Index: number; 870fbfc30aSopenharmony_ci syncData9Index: number; 880fbfc30aSopenharmony_ci syncData10Index: number; 890fbfc30aSopenharmony_ci kvSyncedIndex: number; 900fbfc30aSopenharmony_ci kvSyncTimeIndex: number; 910fbfc30aSopenharmony_ci creatorIndex: number; 920fbfc30aSopenharmony_ci} 930fbfc30aSopenharmony_ci 940fbfc30aSopenharmony_ci/** 950fbfc30aSopenharmony_ci * the columns indexes for table Events 960fbfc30aSopenharmony_ci * 970fbfc30aSopenharmony_ci * @since 2022-05-28 980fbfc30aSopenharmony_ci */ 990fbfc30aSopenharmony_ciexport class EventIndexes implements EventIndexesType { 1000fbfc30aSopenharmony_ci idIndex = 0; 1010fbfc30aSopenharmony_ci syncIdIndex = 0; 1020fbfc30aSopenharmony_ci dirtyIndex = 0; 1030fbfc30aSopenharmony_ci mutatorsIndex = 0; 1040fbfc30aSopenharmony_ci calendarTypeIndex = 0; 1050fbfc30aSopenharmony_ci uuidIndex = 0; 1060fbfc30aSopenharmony_ci imageTypeIndex = 0; 1070fbfc30aSopenharmony_ci lastSyncedIndex = 0; 1080fbfc30aSopenharmony_ci calendarIdIndex = 0; 1090fbfc30aSopenharmony_ci titleIndex = 0; 1100fbfc30aSopenharmony_ci eventLocationIndex = 0; 1110fbfc30aSopenharmony_ci longitudeIndex = 0; 1120fbfc30aSopenharmony_ci latitudeIndex = 0; 1130fbfc30aSopenharmony_ci descriptionIndex = 0; 1140fbfc30aSopenharmony_ci eventColorIndex = 0; 1150fbfc30aSopenharmony_ci eventColorIndexIndex = 0; 1160fbfc30aSopenharmony_ci eventStatusIndex = 0; 1170fbfc30aSopenharmony_ci selfAttendeeStatusIndex = 0; 1180fbfc30aSopenharmony_ci dtStartIndex = 0; 1190fbfc30aSopenharmony_ci dtEndIndex = 0; 1200fbfc30aSopenharmony_ci eventTimeZoneIndex = 0; 1210fbfc30aSopenharmony_ci durationIndex = 0; 1220fbfc30aSopenharmony_ci allDayIndex = 0; 1230fbfc30aSopenharmony_ci accessLevelIndex = 0; 1240fbfc30aSopenharmony_ci availabilityIndex = 0; 1250fbfc30aSopenharmony_ci hasAlarmIndex = 0; 1260fbfc30aSopenharmony_ci hasExtendedPropertiesIndex = 0; 1270fbfc30aSopenharmony_ci rRuleIndex = 0; 1280fbfc30aSopenharmony_ci rDateIndex = 0; 1290fbfc30aSopenharmony_ci exRuleIndex = 0; 1300fbfc30aSopenharmony_ci exDateIndex = 0; 1310fbfc30aSopenharmony_ci originalIdIndex = 0; 1320fbfc30aSopenharmony_ci originalSyncIdIndex = 0; 1330fbfc30aSopenharmony_ci originalInstanceTimeIndex = 0; 1340fbfc30aSopenharmony_ci originalAllDayIndex = 0; 1350fbfc30aSopenharmony_ci lastDateIndex = 0; 1360fbfc30aSopenharmony_ci eventTimeStampIndex = 0; 1370fbfc30aSopenharmony_ci hasAttendeeDataIndex = 0; 1380fbfc30aSopenharmony_ci guestsCanModifyIndex = 0; 1390fbfc30aSopenharmony_ci guestsCanInviteOthersIndex = 0; 1400fbfc30aSopenharmony_ci guestsCanSeeGuestsIndex = 0; 1410fbfc30aSopenharmony_ci organizerIndex = 0; 1420fbfc30aSopenharmony_ci isOrganizerIndex = 0; 1430fbfc30aSopenharmony_ci deletedIndex = 0; 1440fbfc30aSopenharmony_ci eventEndTimezoneIndex = 0; 1450fbfc30aSopenharmony_ci customAppPackageIndex = 0; 1460fbfc30aSopenharmony_ci customAppUriIndex = 0; 1470fbfc30aSopenharmony_ci uid2445Index = 0; 1480fbfc30aSopenharmony_ci versionIndex = 0; 1490fbfc30aSopenharmony_ci eventUuidIndex = 0; 1500fbfc30aSopenharmony_ci hwExtAlertTypeIndex = 0; 1510fbfc30aSopenharmony_ci importantEventTypeIndex = 0; 1520fbfc30aSopenharmony_ci serviceVerifiedIndex = 0; 1530fbfc30aSopenharmony_ci serviceTypeIndex = 0; 1540fbfc30aSopenharmony_ci serviceCpBzUriIndex = 0; 1550fbfc30aSopenharmony_ci serviceCpMngUriIndex = 0; 1560fbfc30aSopenharmony_ci serviceDescriptionIndex = 0; 1570fbfc30aSopenharmony_ci serviceSupportMinVersionIndex = 0; 1580fbfc30aSopenharmony_ci syncData1Index = 0; 1590fbfc30aSopenharmony_ci syncData2Index = 0; 1600fbfc30aSopenharmony_ci syncData3Index = 0; 1610fbfc30aSopenharmony_ci syncData4Index = 0; 1620fbfc30aSopenharmony_ci syncData5Index = 0; 1630fbfc30aSopenharmony_ci syncData6Index = 0; 1640fbfc30aSopenharmony_ci syncData7Index = 0; 1650fbfc30aSopenharmony_ci syncData8Index = 0; 1660fbfc30aSopenharmony_ci syncData9Index = 0; 1670fbfc30aSopenharmony_ci syncData10Index = 0; 1680fbfc30aSopenharmony_ci kvSyncedIndex = 0; 1690fbfc30aSopenharmony_ci kvSyncTimeIndex = 0; 1700fbfc30aSopenharmony_ci creatorIndex = 0; 1710fbfc30aSopenharmony_ci} 1720fbfc30aSopenharmony_ci 1730fbfc30aSopenharmony_ci/** 1740fbfc30aSopenharmony_ci * parse all indexes for table Events 1750fbfc30aSopenharmony_ci * 1760fbfc30aSopenharmony_ci * @param resultSet the result from somewhere rdb.query 1770fbfc30aSopenharmony_ci */ 1780fbfc30aSopenharmony_ciexport function parseIndexes(resultSet: data_rdb.ResultSet): EventIndexes | undefined { 1790fbfc30aSopenharmony_ci if (resultSet == null) { 1800fbfc30aSopenharmony_ci return undefined; 1810fbfc30aSopenharmony_ci } 1820fbfc30aSopenharmony_ci let indexes: EventIndexes = new EventIndexes(); 1830fbfc30aSopenharmony_ci indexes.idIndex = resultSet.getColumnIndex(EventColumns.ID); 1840fbfc30aSopenharmony_ci indexes.syncIdIndex = resultSet.getColumnIndex(EventColumns.SYNC_ID); 1850fbfc30aSopenharmony_ci indexes.dirtyIndex = resultSet.getColumnIndex(EventColumns.DIRTY); 1860fbfc30aSopenharmony_ci indexes.mutatorsIndex = resultSet.getColumnIndex(EventColumns.MUTATORS); 1870fbfc30aSopenharmony_ci indexes.calendarTypeIndex = resultSet.getColumnIndex(EventColumns.EVENT_CALENDAR_TYPE); 1880fbfc30aSopenharmony_ci indexes.imageTypeIndex = resultSet.getColumnIndex(EventColumns.EVENT_IMAGE_TYPE); 1890fbfc30aSopenharmony_ci indexes.lastSyncedIndex = resultSet.getColumnIndex(EventColumns.LAST_SYNCED); 1900fbfc30aSopenharmony_ci indexes.calendarIdIndex = resultSet.getColumnIndex(EventColumns.CALENDAR_ID); 1910fbfc30aSopenharmony_ci indexes.titleIndex = resultSet.getColumnIndex(EventColumns.TITLE); 1920fbfc30aSopenharmony_ci indexes.eventLocationIndex = resultSet.getColumnIndex(EventColumns.EVENT_LOCATION); 1930fbfc30aSopenharmony_ci indexes.longitudeIndex = resultSet.getColumnIndex(EventColumns.LOCATION_LONGITUDE); 1940fbfc30aSopenharmony_ci indexes.latitudeIndex = resultSet.getColumnIndex(EventColumns.LOCATION_LATITUDE); 1950fbfc30aSopenharmony_ci indexes.descriptionIndex = resultSet.getColumnIndex(EventColumns.DESCRIPTION); 1960fbfc30aSopenharmony_ci indexes.eventColorIndex = resultSet.getColumnIndex(EventColumns.EVENT_COLOR); 1970fbfc30aSopenharmony_ci indexes.eventColorIndexIndex = resultSet.getColumnIndex(EventColumns.EVENT_COLOR_INDEX); 1980fbfc30aSopenharmony_ci indexes.eventStatusIndex = resultSet.getColumnIndex(EventColumns.EVENT_STATUS); 1990fbfc30aSopenharmony_ci indexes.selfAttendeeStatusIndex = resultSet.getColumnIndex(EventColumns.SELF_ATTENDEE_STATUS); 2000fbfc30aSopenharmony_ci indexes.dtStartIndex = resultSet.getColumnIndex(EventColumns.DTSTART); 2010fbfc30aSopenharmony_ci indexes.dtEndIndex = resultSet.getColumnIndex(EventColumns.DTEND); 2020fbfc30aSopenharmony_ci indexes.eventTimeZoneIndex = resultSet.getColumnIndex(EventColumns.EVENT_TIMEZONE); 2030fbfc30aSopenharmony_ci indexes.durationIndex = resultSet.getColumnIndex(EventColumns.DURATION); 2040fbfc30aSopenharmony_ci indexes.allDayIndex = resultSet.getColumnIndex(EventColumns.ALLDAY); 2050fbfc30aSopenharmony_ci indexes.accessLevelIndex = resultSet.getColumnIndex(EventColumns.ACCESS_LEVEL); 2060fbfc30aSopenharmony_ci indexes.availabilityIndex = resultSet.getColumnIndex(EventColumns.AVAILABILITY); 2070fbfc30aSopenharmony_ci indexes.hasAlarmIndex = resultSet.getColumnIndex(EventColumns.HAS_ALARM); 2080fbfc30aSopenharmony_ci indexes.hasExtendedPropertiesIndex = resultSet.getColumnIndex(EventColumns.HAS_EXTENDED_PROPERTIES); 2090fbfc30aSopenharmony_ci indexes.rRuleIndex = resultSet.getColumnIndex(EventColumns.RRULE); 2100fbfc30aSopenharmony_ci indexes.rDateIndex = resultSet.getColumnIndex(EventColumns.RDATE); 2110fbfc30aSopenharmony_ci indexes.exRuleIndex = resultSet.getColumnIndex(EventColumns.EXRULE); 2120fbfc30aSopenharmony_ci indexes.exDateIndex = resultSet.getColumnIndex(EventColumns.EXDATE); 2130fbfc30aSopenharmony_ci indexes.originalIdIndex = resultSet.getColumnIndex(EventColumns.ORIGINAL_ID); 2140fbfc30aSopenharmony_ci indexes.originalSyncIdIndex = resultSet.getColumnIndex(EventColumns.ORIGINAL_SYNC_ID); 2150fbfc30aSopenharmony_ci indexes.originalInstanceTimeIndex = resultSet.getColumnIndex(EventColumns.ORIGINAL_INSTANCE_TIME); 2160fbfc30aSopenharmony_ci indexes.originalAllDayIndex = resultSet.getColumnIndex(EventColumns.ORIGINAL_ALL_DAY); 2170fbfc30aSopenharmony_ci indexes.lastDateIndex = resultSet.getColumnIndex(EventColumns.LAST_DATE); 2180fbfc30aSopenharmony_ci indexes.eventTimeStampIndex = resultSet.getColumnIndex(EventColumns.EVENT_TIME_STAMP); 2190fbfc30aSopenharmony_ci indexes.hasAttendeeDataIndex = resultSet.getColumnIndex(EventColumns.HAS_ATTENDEE_DATE); 2200fbfc30aSopenharmony_ci indexes.guestsCanModifyIndex = resultSet.getColumnIndex(EventColumns.GUESTS_CAN_MODIFY); 2210fbfc30aSopenharmony_ci indexes.guestsCanInviteOthersIndex = resultSet.getColumnIndex(EventColumns.GUESTS_CAN_INVITE_OTHERS); 2220fbfc30aSopenharmony_ci indexes.guestsCanSeeGuestsIndex = resultSet.getColumnIndex(EventColumns.GUESTS_CAN_SEE_GUESTS); 2230fbfc30aSopenharmony_ci indexes.organizerIndex = resultSet.getColumnIndex(EventColumns.ORGANIZER); 2240fbfc30aSopenharmony_ci indexes.isOrganizerIndex = resultSet.getColumnIndex(EventColumns.IS_ORGANIZER); 2250fbfc30aSopenharmony_ci indexes.deletedIndex = resultSet.getColumnIndex(EventColumns.DELETED); 2260fbfc30aSopenharmony_ci indexes.eventEndTimezoneIndex = resultSet.getColumnIndex(EventColumns.EVENT_END_TIMEZONE); 2270fbfc30aSopenharmony_ci indexes.customAppPackageIndex = resultSet.getColumnIndex(EventColumns.CUSTOM_APP_PACKAGE); 2280fbfc30aSopenharmony_ci indexes.customAppUriIndex = resultSet.getColumnIndex(EventColumns.CUSTOM_APP_URI); 2290fbfc30aSopenharmony_ci indexes.uid2445Index = resultSet.getColumnIndex(EventColumns.UID2445); 2300fbfc30aSopenharmony_ci indexes.versionIndex = resultSet.getColumnIndex(EventColumns.VERSION); 2310fbfc30aSopenharmony_ci indexes.eventUuidIndex = resultSet.getColumnIndex(EventColumns.EVENT_UUID); 2320fbfc30aSopenharmony_ci indexes.hwExtAlertTypeIndex = resultSet.getColumnIndex(EventColumns.HWEXT_ALERT_TYPE); 2330fbfc30aSopenharmony_ci indexes.importantEventTypeIndex = resultSet.getColumnIndex(EventColumns.IMPORTANT_EVENT_TYPE); 2340fbfc30aSopenharmony_ci indexes.serviceVerifiedIndex = resultSet.getColumnIndex(EventColumns.SERVICE.SERVICE_VERIFIED); 2350fbfc30aSopenharmony_ci indexes.serviceTypeIndex = resultSet.getColumnIndex(EventColumns.SERVICE.SERVICE_TYPE); 2360fbfc30aSopenharmony_ci indexes.serviceCpBzUriIndex = resultSet.getColumnIndex(EventColumns.SERVICE.SERVICE_CP_BZ_URI); 2370fbfc30aSopenharmony_ci indexes.serviceCpMngUriIndex = resultSet.getColumnIndex(EventColumns.SERVICE.SERVICE_CP_MNG_URI); 2380fbfc30aSopenharmony_ci indexes.serviceDescriptionIndex = resultSet.getColumnIndex(EventColumns.SERVICE.SERVICE_DESCRIPTION); 2390fbfc30aSopenharmony_ci indexes.serviceSupportMinVersionIndex = resultSet.getColumnIndex(EventColumns.SERVICE.SERVICE_MIN_VERSION); 2400fbfc30aSopenharmony_ci indexes.syncData1Index = resultSet.getColumnIndex(EventColumns.SYNC_DATA1); 2410fbfc30aSopenharmony_ci indexes.syncData2Index = resultSet.getColumnIndex(EventColumns.SYNC_DATA2); 2420fbfc30aSopenharmony_ci indexes.syncData3Index = resultSet.getColumnIndex(EventColumns.SYNC_DATA3); 2430fbfc30aSopenharmony_ci indexes.syncData4Index = resultSet.getColumnIndex(EventColumns.SYNC_DATA4); 2440fbfc30aSopenharmony_ci indexes.syncData5Index = resultSet.getColumnIndex(EventColumns.SYNC_DATA5); 2450fbfc30aSopenharmony_ci indexes.syncData6Index = resultSet.getColumnIndex(EventColumns.SYNC_DATA6); 2460fbfc30aSopenharmony_ci indexes.syncData7Index = resultSet.getColumnIndex(EventColumns.SYNC_DATA7); 2470fbfc30aSopenharmony_ci indexes.syncData8Index = resultSet.getColumnIndex(EventColumns.SYNC_DATA8); 2480fbfc30aSopenharmony_ci indexes.syncData9Index = resultSet.getColumnIndex(EventColumns.SYNC_DATA9); 2490fbfc30aSopenharmony_ci indexes.syncData10Index = resultSet.getColumnIndex(EventColumns.SYNC_DATA10); 2500fbfc30aSopenharmony_ci indexes.kvSyncedIndex = resultSet.getColumnIndex(EventColumns.KV_SYNC); 2510fbfc30aSopenharmony_ci indexes.kvSyncTimeIndex = resultSet.getColumnIndex(EventColumns.KV_SYNC_TIME); 2520fbfc30aSopenharmony_ci indexes.creatorIndex = resultSet.getColumnIndex(EventColumns.CREATOR); 2530fbfc30aSopenharmony_ci return indexes; 2540fbfc30aSopenharmony_ci}