You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeAppointmentrecord {|readonlyint id;
int doctorId;
time:CivilappointmentTime;
db:AppointmentStatusstatus;
record {|int id;
string name;
string phoneNumber;
|} patient;
|};
resourcefunction get doctors/[intid]/appointments(intyear, intmonth, intday) returnsAppointment[]|error {
returnfromAppointmentappointmentindbClient->/appointments(targetType=Appointment)
whereappointment.doctorId==id&&appointment.appointmentTime.year==year&&appointment.appointmentTime.month==month&&appointment.appointmentTime.day==dayselectappointment;
}
It failed at runtime giving the below error
time=2024-05-15T16:04:59.294+05:30 level=ERROR module=ballerina/http message="unhandled error returned from the service" error={"causes":[],"message":"Error while executing SQL query: SELECT `Appointment`.`id` AS `id`,`Appointment`.`doctorId` AS `doctorId`,`Appointment`.`appointmentTime` AS `appointmentTime`,`Appointment`.`status` AS `status`,`patient`.`id` AS `patient.id`,`patient`.`name` AS `patient.name`,`patient`.`phoneNumber` AS `patient.phoneNumber` FROM `Appointment` AS `Appointment` LEFT JOIN `Patient` `patient` ON `patient`.`id` = `Appointment`.`patientId` WHERE Appointment.doctorId = ? AND appointmentTime.year = ? AND appointmentTime.month = ? AND appointmentTime.day = ? . Unknown column 'appointmentTime.year' in 'where clause'.","detail":{},"stackTrace":[{"callableName":"next","moduleName":"ballerinax.persist.sql.1.PersistSQLStream","fileName":"stream_types.bal","lineNumber":56},{"callableName":"process","moduleName":"ballerina.lang.query.0._InitFunction","fileName":"types.bal","lineNumber":141},{"callableName":"process","moduleName":"ballerina.lang.query.0._InputFunction","fileName":"types.bal","lineNumber":202},{"callableName":"process","moduleName":"ballerina.lang.query.0._FilterFunction","fileName":"types.bal","lineNumber":554},{"callableName":"process","moduleName":"ballerina.lang.query.0._SelectFunction","fileName":"types.bal","lineNumber":783},{"callableName":"$gen$$anon$method$delegate$_StreamFunction&0046process$0","moduleName":"ballerina.lang.query.0","fileName":"types.bal","lineNumber":93}]} path="/hospital/doctors/1/appointments?year=2023&month=07&day=01" method="GET"
We should handle this scenario
**Steps to reproduce:**
**Affected Versions:**
**OS, DB, other environment details and versions:**
**Related Issues (optional):**
<!-- Any related issues such as sub tasks, issues reported in other repositories (e.g component repositories), similar problems, etc. -->
**Suggested Labels (optional):**
<!-- Optional comma separated list of suggested labels. Non committers can’t assign labels to issues, so this will help issue creators who are not a committer to suggest possible labels-->
**Suggested Assignees (optional):**
<!--Optional comma separated list of suggested team members who should attend the issue. Non committers can’t assign issues to assignees, so this will help issue creators who are not a committer to suggest possible assignees-->
The text was updated successfully, but these errors were encountered:
Description:
When we have something like below,
It failed at runtime giving the below error
We should handle this scenario
The text was updated successfully, but these errors were encountered: