Commit 4eaa87c
authored
fix: Ensure cross-database compatibility for unread message count query (#1)
In the "ofpresence" table, the "offlineDate" field has the data type "VARCHAR/CHAR" depending on the database, and in the query we are trying to compare this field with the "sentDate" field, which has the data type "BIGINT/INTEGER". This results in the following error:
```
ERROR: operator does not exist: bigint > character varying
LINE 3: JOIN ofPresence p ON (a.sentDate > p.offlineDate)
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
```
This change replaces implicit comparison with explicit, database-specific
CAST expressions. The correct CAST is selected at runtime based on the
underlying database (MySQL, PostgreSQL, SQL Server, Oracle, Sybase),
ensuring reliable and portable behavior across all Openfire-supported DBs.1 parent 548f23e commit 4eaa87c
1 file changed
Lines changed: 26 additions & 7 deletions
Lines changed: 26 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
45 | 63 | | |
46 | 64 | | |
47 | 65 | | |
| |||
70 | 88 | | |
71 | 89 | | |
72 | 90 | | |
73 | | - | |
| 91 | + | |
| 92 | + | |
74 | 93 | | |
75 | 94 | | |
76 | 95 | | |
| |||
0 commit comments