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 { Calendars } from './Calendars'; 190fbfc30aSopenharmony_ciimport { CalendarsIndexes } from './CalendarsIndexes'; 200fbfc30aSopenharmony_ci 210fbfc30aSopenharmony_ci/** 220fbfc30aSopenharmony_ci * parse all columns for table Calendars 230fbfc30aSopenharmony_ci * 240fbfc30aSopenharmony_ci * @param resultSet the result from somewhere rdb.query 250fbfc30aSopenharmony_ci */ 260fbfc30aSopenharmony_ciexport function parseCalendars(resultSet: data_rdb.ResultSet, 270fbfc30aSopenharmony_ci indexes: CalendarsIndexes | undefined): Calendars | undefined { 280fbfc30aSopenharmony_ci if (resultSet === null || resultSet === undefined || indexes === null || indexes === undefined) { 290fbfc30aSopenharmony_ci return undefined; 300fbfc30aSopenharmony_ci } 310fbfc30aSopenharmony_ci let calendars: Calendars = new Calendars(); 320fbfc30aSopenharmony_ci if (indexes.idIndex >= 0) { 330fbfc30aSopenharmony_ci calendars.id = resultSet.getLong(indexes.idIndex); 340fbfc30aSopenharmony_ci } 350fbfc30aSopenharmony_ci if (indexes.accountNameIndex >= 0) { 360fbfc30aSopenharmony_ci calendars.accountName = resultSet.getString(indexes.accountNameIndex); 370fbfc30aSopenharmony_ci } 380fbfc30aSopenharmony_ci if (indexes.accountTypeIndex >= 0) { 390fbfc30aSopenharmony_ci calendars.accountType = resultSet.getString(indexes.accountTypeIndex); 400fbfc30aSopenharmony_ci } 410fbfc30aSopenharmony_ci if (indexes.syncIdIndex >= 0) { 420fbfc30aSopenharmony_ci calendars.syncId = resultSet.getString(indexes.syncIdIndex); 430fbfc30aSopenharmony_ci } 440fbfc30aSopenharmony_ci if (indexes.dirtyIndex >= 0) { 450fbfc30aSopenharmony_ci calendars.dirty = resultSet.getLong(indexes.dirtyIndex); 460fbfc30aSopenharmony_ci } 470fbfc30aSopenharmony_ci if (indexes.mutatorsIndex >= 0) { 480fbfc30aSopenharmony_ci calendars.mutators = resultSet.getString(indexes.mutatorsIndex); 490fbfc30aSopenharmony_ci } 500fbfc30aSopenharmony_ci if (indexes.nameIndex >= 0) { 510fbfc30aSopenharmony_ci calendars.name = resultSet.getString(indexes.nameIndex); 520fbfc30aSopenharmony_ci } 530fbfc30aSopenharmony_ci if (indexes.calendarDisplayNameIndex >= 0) { 540fbfc30aSopenharmony_ci calendars.calendarDisplayName = resultSet.getString(indexes.calendarDisplayNameIndex); 550fbfc30aSopenharmony_ci } 560fbfc30aSopenharmony_ci if (indexes.calendarColorIndex >= 0) { 570fbfc30aSopenharmony_ci calendars.calendarColor = resultSet.getLong(indexes.calendarColorIndex); 580fbfc30aSopenharmony_ci } 590fbfc30aSopenharmony_ci if (indexes.calendarColorIndexIndex >= 0) { 600fbfc30aSopenharmony_ci calendars.calendarColorIndex = resultSet.getString(indexes.calendarColorIndexIndex); 610fbfc30aSopenharmony_ci } 620fbfc30aSopenharmony_ci if (indexes.calendarAccessLevelIndex >= 0) { 630fbfc30aSopenharmony_ci calendars.calendarAccessLevel = resultSet.getLong(indexes.calendarAccessLevelIndex); 640fbfc30aSopenharmony_ci } 650fbfc30aSopenharmony_ci if (indexes.visibleIndex >= 0) { 660fbfc30aSopenharmony_ci calendars.visible = resultSet.getLong(indexes.visibleIndex); 670fbfc30aSopenharmony_ci } 680fbfc30aSopenharmony_ci if (indexes.syncEventsIndex >= 0) { 690fbfc30aSopenharmony_ci calendars.syncEvents = resultSet.getLong(indexes.syncEventsIndex); 700fbfc30aSopenharmony_ci } 710fbfc30aSopenharmony_ci if (indexes.calendarLocationIndex >= 0) { 720fbfc30aSopenharmony_ci calendars.calendarLocation = resultSet.getString(indexes.calendarLocationIndex); 730fbfc30aSopenharmony_ci } 740fbfc30aSopenharmony_ci if (indexes.calendarTimezoneIndex >= 0) { 750fbfc30aSopenharmony_ci calendars.calendarTimezone = resultSet.getString(indexes.calendarTimezoneIndex); 760fbfc30aSopenharmony_ci } 770fbfc30aSopenharmony_ci if (indexes.ownerAccountIndex >= 0) { 780fbfc30aSopenharmony_ci calendars.ownerAccount = resultSet.getString(indexes.ownerAccountIndex); 790fbfc30aSopenharmony_ci } 800fbfc30aSopenharmony_ci if (indexes.isPrimaryIndex >= 0) { 810fbfc30aSopenharmony_ci calendars.isPrimary = resultSet.getLong(indexes.isPrimaryIndex); 820fbfc30aSopenharmony_ci } 830fbfc30aSopenharmony_ci if (indexes.canOrganizerRespondIndex >= 0) { 840fbfc30aSopenharmony_ci calendars.canOrganizerRespond = resultSet.getLong(indexes.canOrganizerRespondIndex); 850fbfc30aSopenharmony_ci } 860fbfc30aSopenharmony_ci if (indexes.canModifyTimeZoneIndex >= 0) { 870fbfc30aSopenharmony_ci calendars.canModifyTimeZone = resultSet.getLong(indexes.canModifyTimeZoneIndex); 880fbfc30aSopenharmony_ci } 890fbfc30aSopenharmony_ci if (indexes.canPartiallyUpdateIndex >= 0) { 900fbfc30aSopenharmony_ci calendars.canPartiallyUpdate = resultSet.getLong(indexes.canPartiallyUpdateIndex); 910fbfc30aSopenharmony_ci } 920fbfc30aSopenharmony_ci if (indexes.maxRemindersIndex >= 0) { 930fbfc30aSopenharmony_ci calendars.maxReminders = resultSet.getLong(indexes.maxRemindersIndex); 940fbfc30aSopenharmony_ci } 950fbfc30aSopenharmony_ci if (indexes.allowedRemindersIndex >= 0) { 960fbfc30aSopenharmony_ci calendars.allowedReminders = resultSet.getString(indexes.allowedRemindersIndex); 970fbfc30aSopenharmony_ci } 980fbfc30aSopenharmony_ci if (indexes.allowedAvailabilityIndex >= 0) { 990fbfc30aSopenharmony_ci calendars.allowedAvailability = resultSet.getString(indexes.allowedAvailabilityIndex); 1000fbfc30aSopenharmony_ci } 1010fbfc30aSopenharmony_ci if (indexes.allowedAttendeeTypesIndex >= 0) { 1020fbfc30aSopenharmony_ci calendars.allowedAttendeeTypes = resultSet.getString(indexes.allowedAttendeeTypesIndex); 1030fbfc30aSopenharmony_ci } 1040fbfc30aSopenharmony_ci if (indexes.deletedIndex >= 0) { 1050fbfc30aSopenharmony_ci calendars.deleted = resultSet.getLong(indexes.deletedIndex); 1060fbfc30aSopenharmony_ci } 1070fbfc30aSopenharmony_ci if (indexes.calendarTimeStampIndex >= 0) { 1080fbfc30aSopenharmony_ci calendars.calendarTimeStamp = resultSet.getLong(indexes.calendarTimeStampIndex); 1090fbfc30aSopenharmony_ci } 1100fbfc30aSopenharmony_ci if (indexes.calSync1Index >= 0) { 1110fbfc30aSopenharmony_ci calendars.calSync1 = resultSet.getString(indexes.calSync1Index); 1120fbfc30aSopenharmony_ci } 1130fbfc30aSopenharmony_ci if (indexes.calSync2Index >= 0) { 1140fbfc30aSopenharmony_ci calendars.calSync2 = resultSet.getString(indexes.calSync2Index); 1150fbfc30aSopenharmony_ci } 1160fbfc30aSopenharmony_ci if (indexes.calSync3Index >= 0) { 1170fbfc30aSopenharmony_ci calendars.calSync3 = resultSet.getString(indexes.calSync3Index); 1180fbfc30aSopenharmony_ci } 1190fbfc30aSopenharmony_ci if (indexes.calSync4Index >= 0) { 1200fbfc30aSopenharmony_ci calendars.calSync4 = resultSet.getString(indexes.calSync4Index); 1210fbfc30aSopenharmony_ci } 1220fbfc30aSopenharmony_ci if (indexes.calSync5Index >= 0) { 1230fbfc30aSopenharmony_ci calendars.calSync5 = resultSet.getString(indexes.calSync5Index); 1240fbfc30aSopenharmony_ci } 1250fbfc30aSopenharmony_ci if (indexes.calSync6Index >= 0) { 1260fbfc30aSopenharmony_ci calendars.calSync6 = resultSet.getString(indexes.calSync6Index); 1270fbfc30aSopenharmony_ci } 1280fbfc30aSopenharmony_ci if (indexes.calSync7Index >= 0) { 1290fbfc30aSopenharmony_ci calendars.calSync7 = resultSet.getString(indexes.calSync7Index); 1300fbfc30aSopenharmony_ci } 1310fbfc30aSopenharmony_ci if (indexes.calSync8Index >= 0) { 1320fbfc30aSopenharmony_ci calendars.calSync8 = resultSet.getString(indexes.calSync8Index); 1330fbfc30aSopenharmony_ci } 1340fbfc30aSopenharmony_ci if (indexes.calSync9Index >= 0) { 1350fbfc30aSopenharmony_ci calendars.calSync9 = resultSet.getString(indexes.calSync9Index); 1360fbfc30aSopenharmony_ci } 1370fbfc30aSopenharmony_ci if (indexes.calSync10Index >= 0) { 1380fbfc30aSopenharmony_ci calendars.calSync10 = resultSet.getString(indexes.calSync10Index); 1390fbfc30aSopenharmony_ci } 1400fbfc30aSopenharmony_ci if (indexes.canReminderIndex >= 0) { 1410fbfc30aSopenharmony_ci calendars.canReminder = resultSet.getLong(indexes.canReminderIndex); 1420fbfc30aSopenharmony_ci } 1430fbfc30aSopenharmony_ci if (indexes.creatorIndex >= 0) { 1440fbfc30aSopenharmony_ci calendars.creator = resultSet.getString(indexes.creatorIndex); 1450fbfc30aSopenharmony_ci } 1460fbfc30aSopenharmony_ci return calendars; 1470fbfc30aSopenharmony_ci}