Skip to content

SQL exception with SQL Server #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
guusdk opened this issue Aug 24, 2022 · 1 comment
Closed

SQL exception with SQL Server #232

guusdk opened this issue Aug 24, 2022 · 1 comment

Comments

@guusdk
Copy link
Member

guusdk commented Aug 24, 2022

As reported in https://discourse.igniterealtime.org/t/openfire-messages-are-not-retrieved-4-6-7/

com.reucon.openfire.plugin.archive.xep0313.IQQueryHandler - An unexpected exception occurred while processing:
<iq id="af533090-167d-4ef4-b049-42f08b46802c" to="119_98_95_99_104_97_116_105_100_95_49_48_48_49_48_48@conference.openfire.mydomain.ai" type="set" from="[email protected]/9n8xlbdgcj">
   <query xmlns="urn:xmpp:mam:2" queryid="on-initial-load">
      <x xmlns="jabber:x:data" type="submit">
         <field type="hidden" var="FORM_TYPE">
            <value>urn:xmpp:mam:2</value>
         </field>
      </x>
      <set xmlns="http://jabber.org/protocol/rsm">
         <max>100</max>
         <before />
      </set>
      <flip-page />
   </query>
</iq>
com.reucon.openfire.plugin.archive.impl.DataRetrievalException: com.reucon.openfire.plugin.archive.impl.DataRetrievalException: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near 'LIMIT'.
    at com.reucon.openfire.plugin.archive.xep0313.IQQueryHandler.retrieveMessages(IQQueryHandler.java:471) ~[?:?]
    at com.reucon.openfire.plugin.archive.xep0313.IQQueryHandler.lambda$handleIQ$2(IQQueryHandler.java:269) ~[?:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_202]
    at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_202]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_202]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_202]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_202]

Totzkotz suggests:

yes thats seems to be a bug, because Sql Server does not know the "LIMIT" keyword. it uses "TOP" instead...
some code switches missing here:

@mightymop
Copy link
Contributor

mightymop commented Aug 24, 2022

only this one ;)

  1. allready has a special method for sqlserver

maybe adding

... else if (DbConnectionManager.getDatabaseType() == DbConnectionManager.DatabaseType.sqlserver) { query.append(" OFFSET ").append(startIndex).append(" ROWS FETCH NEXT ").append(numResults).append(" ROWS ONLY"); } ...

will do it...

mightymop added a commit to mightymop/openfire-monitoring-plugin that referenced this issue Aug 26, 2022
mightymop added a commit to mightymop/openfire-monitoring-plugin that referenced this issue Aug 26, 2022
guusdk pushed a commit to mightymop/openfire-monitoring-plugin that referenced this issue Oct 24, 2022
guusdk added a commit to mightymop/openfire-monitoring-plugin that referenced this issue Oct 24, 2022
@guusdk guusdk closed this as completed in 45b6fa9 Oct 24, 2022
guusdk added a commit that referenced this issue Oct 24, 2022
guusdk pushed a commit to guusdk/openfire-monitoring-plugin that referenced this issue Oct 27, 2022
guusdk added a commit to guusdk/openfire-monitoring-plugin that referenced this issue Oct 27, 2022
guusdk pushed a commit that referenced this issue Oct 27, 2022
guusdk added a commit that referenced this issue Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants