Closed emikhelo closed 4 years ago
I have set Oracle NLS_LANG=LATVIAN. Oracle sql results are sorted correctly using Latvian collation sequence, such as:
SQL> select nosaukums from klasifikators where veids = 'DISPECERA_RAJONS' order by nosaukums asc;
Āboliņa Baiba Gunta Muke Kalpisa Inita Kazoka Inese K?imovica Dzintra Lindersone Mirdza Lisjonoka Elita Vidzemes priekspils?ta Ziemele Velta Zvaigzne Gita
10 rows selected.
However, same select executed by Tresql puts Āboliņa at the end of the list:
klasifikators [ veids = 'DISPECERA_RAJONS'] { nosaukums }#(nosaukums)
C:\proj\rugis_git\klints>scala -Djdbc.drivers=oracle.jdbc.OracleDriver -Duniso.query.db=jdbc:oracle:thin:rugis/gis123@redmine.uniso.lv:1521:orcl -Duniso.query.user=rugis -Duniso.query.password=gis123 -classpath lib/ojdbc14.jar;lib/tresql_2.9.1-1.2.1.jar test.scala ----------start---------- oracle.jdbc.driver.T4CConnection@466e06d7 select nosaukums from klasifikators where veids = 'DISPECERA_RAJONS' order by nosaukums asc Bind vars: nosaukums:Gunta Muke nosaukums:Kalpiša Inita nosaukums:Kažoka Inese nosaukums:Kļimoviča Dzintra nosaukums:Lindersone Mirdza nosaukums:Lisjonoka Elita nosaukums:Vidzemes priekšpilsēta nosaukums:Ziemele Velta nosaukums:Zvaigzne Gita nosaukums:Āboliņa Baiba ----------end----------
Test case:
Class.forName("oracle.jdbc.OracleDriver") import org.tresql. import org.tresql.result. import scala.collection.mutable.HashMap
val conn = java.sql.DriverManager.getConnection(System.getProperty("uniso.query.db"),System.getProperty("uniso.query.user"), System.getProperty("uniso.query.password")) val md = metadata.JDBCMetaData("orcl", "rugis")
Env update conn Env update md
val LOG_LEVEL = 1;
if (LOG_LEVEL > 0) Env update ((msg, level) => println (msg))
println("----------start----------") log(Env.conn)
val rowSelect = "klasifikators [ veids = 'DISPECERA_RAJONS'] { nosaukums }#(nosaukums)"
Query.foreach(rowSelect)(row => { log("nosaukums:" + row(0)) })
println("----------end----------")
def log(s:Any) = { if (LOG_LEVEL > 0) println(s) }
def inform(s:Any) = println(s) def error(s:Any) = println("ERROR: " + s)
This seems to be oracle jdbc related issue.
I have set Oracle NLS_LANG=LATVIAN. Oracle sql results are sorted correctly using Latvian collation sequence, such as:
SQL> select nosaukums from klasifikators where veids = 'DISPECERA_RAJONS' order by nosaukums asc;
NOSAUKUMS
Āboliņa Baiba Gunta Muke Kalpisa Inita Kazoka Inese K?imovica Dzintra Lindersone Mirdza Lisjonoka Elita Vidzemes priekspils?ta Ziemele Velta Zvaigzne Gita
10 rows selected.
However, same select executed by Tresql puts Āboliņa at the end of the list:
klasifikators [ veids = 'DISPECERA_RAJONS'] { nosaukums }#(nosaukums)
C:\proj\rugis_git\klints>scala -Djdbc.drivers=oracle.jdbc.OracleDriver -Duniso.query.db=jdbc:oracle:thin:rugis/gis123@redmine.uniso.lv:1521:orcl -Duniso.query.user=rugis -Duniso.query.password=gis123 -classpath lib/ojdbc14.jar;lib/tresql_2.9.1-1.2.1.jar test.scala ----------start---------- oracle.jdbc.driver.T4CConnection@466e06d7 select nosaukums from klasifikators where veids = 'DISPECERA_RAJONS' order by nosaukums asc Bind vars: nosaukums:Gunta Muke nosaukums:Kalpiša Inita nosaukums:Kažoka Inese nosaukums:Kļimoviča Dzintra nosaukums:Lindersone Mirdza nosaukums:Lisjonoka Elita nosaukums:Vidzemes priekšpilsēta nosaukums:Ziemele Velta nosaukums:Zvaigzne Gita nosaukums:Āboliņa Baiba ----------end----------
Test case:
Class.forName("oracle.jdbc.OracleDriver") import org.tresql. import org.tresql.result. import scala.collection.mutable.HashMap
val conn = java.sql.DriverManager.getConnection(System.getProperty("uniso.query.db"),System.getProperty("uniso.query.user"), System.getProperty("uniso.query.password")) val md = metadata.JDBCMetaData("orcl", "rugis")
Env update conn Env update md
val LOG_LEVEL = 1;
if (LOG_LEVEL > 0) Env update ((msg, level) => println (msg))
println("----------start----------") log(Env.conn)
val rowSelect = "klasifikators [ veids = 'DISPECERA_RAJONS'] { nosaukums }#(nosaukums)"
Query.foreach(rowSelect)(row => { log("nosaukums:" + row(0)) })
println("----------end----------")
def log(s:Any) = { if (LOG_LEVEL > 0) println(s) }
def inform(s:Any) = println(s) def error(s:Any) = println("ERROR: " + s)