[Libreoffice-bugs] [Bug 139600] New: Editing SQL correct query generate SQL error if inserting a parameter

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Thu Jan 14 10:04:38 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=139600

            Bug ID: 139600
           Summary: Editing  SQL correct query generate SQL error if
                    inserting a parameter
           Product: LibreOffice
           Version: 6.4.5.2 release
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Base
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: diego.ercolani at gmail.com

I have a bacula installation (mariadb based) I connect correctely with dbbeaver
via JDBC and also with libreofficebase. I finally have to implement this query
written via SQL:
SELECT 
   MediaId
  ,VolumeName 
  ,Slot
  ,VolStatus
  ,Enabled
  ,VolBytes
  ,VolFiles
  ,VolRetention
  ,Recycle
  ,MediaType
  ,VolType
  ,VolParts
  ,LastWritten
  ,ExpiresIn FROM 
  (
       SELECT 
           MediaId
          ,CAST(VolumeName AS VARCHAR(20)) AS VolumeName
          ,VolStatus
          ,Enabled
          ,VolByte
          ,VolFiles
          ,VolRetention
          ,Recycle
          ,CONCAT ( CASE
                      WHEN Slot < 13 THEN 'Left '
                      ELSE 'Right '
                    END 
                   , Slot ) AS Slot
          ,CAST( MediaType AS VARCHAR(10)) AS MediaType
          ,VolType
          ,VolParts
          ,LastWritten
          ,GREATEST(
             0
            , CAST(UNIX_TIMESTAMP(LastWritten) AS INTEGER)
            + CAST(VolRetention AS INTEGER)
            - CAST(UNIX_TIMESTAMP(NOW()) AS INTEGER)) AS ExpiresIn
        FROM Media WHERE 
         InChanger = 1
        ORDER by ExpiresIn DESC LIMIT :ask
) AS InsiemeNastri
ORDER BY Slot 

The problem is:
If I save the query "as is" or try to run, it fail with a "SQL Syntax Error".
If I substitute the ":ask" parameter with a number (e.g. 6) It works and I can
run the query correctly. If I try to view it in "design mode" it fails with
"SQL Error". I'm going to port the error in hsqldb so I can add the attachment
to this bug

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210114/74b900cb/attachment.htm>


More information about the Libreoffice-bugs mailing list