https://bugs.documentfoundation.org/show_bug.cgi?id=167546
Bug ID: 167546
Summary: Incorrect execution of SQL queries for SQLite
Product: LibreOffice
Version: 25.2.4.3 release
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Base
Assignee: [email protected]
Reporter: [email protected]
Created attachment 201840
--> https://bugs.documentfoundation.org/attachment.cgi?id=201840&action=edit
test.odb
Steps to reproduce.
1. Download the attached files test.odb and test.db to a folder (in my case
it's C:\temp).
The SQLite file test.db contains one table "test" with one field "name". The
"test" table has one record with the value of the field "name" equal to "A".
2. Install jdbc driver for SQLite. I downloaded the driver from the link [1].
3. Change the path to the test.db file in test.odb. Test the connection.
4. Run the following macro (after adjusting the path C:\temp).
A new Calc file will be created, which will contain the result of the SQL
query.
Cell C2 is equal to 0.
Must be "A".
Sub TestSQLite()
Dim fileURL As String, sqlQuery As String
Dim oDoc As Object, oRange As Object
Dim props(3) As New com.sun.star.beans.PropertyValue
fileURL=ConvertToURL("C:\Temp\Test.odb") ' ** !! **
sqlQuery="Select name, name || '' strexp from Test"
oDoc = StarDesktop.LoadComponentFromUrl("private:factory/scalc", "_blank", 0,
Array())
props(0).Name="DatabaseName" : props(0).Value=FileURL
props(1).Name="SourceType" : props(1).Value=1
props(2).Name="SourceObject" : props(2).Value=sqlQuery
props(3).Name="IsNative" : props(3).Value=True
oRange=oDoc.Sheets(0).GetCellRangeByName("A1")
oRange.doImport props
End Sub
[1]. https://github.com/xerial/sqlite-jdbc
--
You are receiving this mail because:
You are the assignee for the bug.