[jira] [Commented] (CALCITE-1371) PreparedStatement does not process Date type correctly
[ https://issues.apache.org/jira/browse/CALCITE-1371?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15477623#comment-15477623 ] Julian Hyde commented on CALCITE-1371: -- Fixed in http://git-wip-us.apache.org/repos/asf/calcite/commit/23c14b5f. Thanks for the PR, [~yimingliu]! > PreparedStatement does not process Date type correctly > --- > > Key: CALCITE-1371 > URL: https://issues.apache.org/jira/browse/CALCITE-1371 > Project: Calcite > Issue Type: Bug > Components: avatica >Affects Versions: 1.8.0 >Reporter: Billy(Yiming) Liu >Assignee: Billy(Yiming) Liu >Priority: Minor > Fix For: avatica-1.9.0 > > > I have problem when passing date parameter in PreparedStatement. Following is > the sample code: > TimeZone tzUtc = TimeZone.getTimeZone("UTC"); > Calendar cUtc = Calendar.getInstance(tzUtc); > cUtc.set(2013, 10, 5, 0, 0, 0); > java.sql.Date passSqlDate = new java.sql.Date(cUtc.getTimeInMillis()); > statement.setDate(1, passSqlDate, cUtc); > I try to pass Date'2013/11/5' to the database, but from the debug info I > found the > database received '2013/10/4' (GMT -8 Timezone) always. It ignored the > Calendar I passed in. > There are some Calcite code a little strange, I have marked by color: > Why setTimestamp and setTime have effective parameter 'calendar', but setDate > ignore the > parameter. Is that the root cause? > AvaticaSite.java > Line 189-199 > public void setTimestamp(Timestamp x, Calendar calendar) { > slots[index] = wrap(ColumnMetaData.Rep.JAVA_SQL_TIMESTAMP, x, calendar); > } > public void setTime(Time x, Calendar calendar) { > slots[index] = wrap(ColumnMetaData.Rep.JAVA_SQL_TIME, x, calendar); > } > public void setDate(Date x, Calendar cal) { > slots[index] = wrap(ColumnMetaData.Rep.JAVA_SQL_DATE, x, calendar); > } -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CALCITE-1371) PreparedStatement does not process Date type correctly
[ https://issues.apache.org/jira/browse/CALCITE-1371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Josh Elser updated CALCITE-1371: Assignee: Billy(Yiming) Liu (was: Julian Hyde) > PreparedStatement does not process Date type correctly > --- > > Key: CALCITE-1371 > URL: https://issues.apache.org/jira/browse/CALCITE-1371 > Project: Calcite > Issue Type: Bug > Components: avatica >Affects Versions: 1.8.0 >Reporter: Billy(Yiming) Liu >Assignee: Billy(Yiming) Liu >Priority: Minor > Fix For: avatica-1.9.0 > > > I have problem when passing date parameter in PreparedStatement. Following is > the sample code: > TimeZone tzUtc = TimeZone.getTimeZone("UTC"); > Calendar cUtc = Calendar.getInstance(tzUtc); > cUtc.set(2013, 10, 5, 0, 0, 0); > java.sql.Date passSqlDate = new java.sql.Date(cUtc.getTimeInMillis()); > statement.setDate(1, passSqlDate, cUtc); > I try to pass Date'2013/11/5' to the database, but from the debug info I > found the > database received '2013/10/4' (GMT -8 Timezone) always. It ignored the > Calendar I passed in. > There are some Calcite code a little strange, I have marked by color: > Why setTimestamp and setTime have effective parameter 'calendar', but setDate > ignore the > parameter. Is that the root cause? > AvaticaSite.java > Line 189-199 > public void setTimestamp(Timestamp x, Calendar calendar) { > slots[index] = wrap(ColumnMetaData.Rep.JAVA_SQL_TIMESTAMP, x, calendar); > } > public void setTime(Time x, Calendar calendar) { > slots[index] = wrap(ColumnMetaData.Rep.JAVA_SQL_TIME, x, calendar); > } > public void setDate(Date x, Calendar cal) { > slots[index] = wrap(ColumnMetaData.Rep.JAVA_SQL_DATE, x, calendar); > } -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CALCITE-1371) PreparedStatement does not process Date type correctly
[ https://issues.apache.org/jira/browse/CALCITE-1371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Josh Elser updated CALCITE-1371: Fix Version/s: avatica-1.9.0 > PreparedStatement does not process Date type correctly > --- > > Key: CALCITE-1371 > URL: https://issues.apache.org/jira/browse/CALCITE-1371 > Project: Calcite > Issue Type: Bug > Components: avatica >Affects Versions: 1.8.0 >Reporter: Billy(Yiming) Liu >Assignee: Julian Hyde >Priority: Minor > Fix For: avatica-1.9.0 > > > I have problem when passing date parameter in PreparedStatement. Following is > the sample code: > TimeZone tzUtc = TimeZone.getTimeZone("UTC"); > Calendar cUtc = Calendar.getInstance(tzUtc); > cUtc.set(2013, 10, 5, 0, 0, 0); > java.sql.Date passSqlDate = new java.sql.Date(cUtc.getTimeInMillis()); > statement.setDate(1, passSqlDate, cUtc); > I try to pass Date'2013/11/5' to the database, but from the debug info I > found the > database received '2013/10/4' (GMT -8 Timezone) always. It ignored the > Calendar I passed in. > There are some Calcite code a little strange, I have marked by color: > Why setTimestamp and setTime have effective parameter 'calendar', but setDate > ignore the > parameter. Is that the root cause? > AvaticaSite.java > Line 189-199 > public void setTimestamp(Timestamp x, Calendar calendar) { > slots[index] = wrap(ColumnMetaData.Rep.JAVA_SQL_TIMESTAMP, x, calendar); > } > public void setTime(Time x, Calendar calendar) { > slots[index] = wrap(ColumnMetaData.Rep.JAVA_SQL_TIME, x, calendar); > } > public void setDate(Date x, Calendar cal) { > slots[index] = wrap(ColumnMetaData.Rep.JAVA_SQL_DATE, x, calendar); > } -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (CALCITE-1371) PreparedStatement does not process Date type correctly
[ https://issues.apache.org/jira/browse/CALCITE-1371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Josh Elser updated CALCITE-1371: Component/s: (was: core) avatica > PreparedStatement does not process Date type correctly > --- > > Key: CALCITE-1371 > URL: https://issues.apache.org/jira/browse/CALCITE-1371 > Project: Calcite > Issue Type: Bug > Components: avatica >Affects Versions: 1.8.0 >Reporter: Billy(Yiming) Liu >Assignee: Julian Hyde >Priority: Minor > Fix For: avatica-1.9.0 > > > I have problem when passing date parameter in PreparedStatement. Following is > the sample code: > TimeZone tzUtc = TimeZone.getTimeZone("UTC"); > Calendar cUtc = Calendar.getInstance(tzUtc); > cUtc.set(2013, 10, 5, 0, 0, 0); > java.sql.Date passSqlDate = new java.sql.Date(cUtc.getTimeInMillis()); > statement.setDate(1, passSqlDate, cUtc); > I try to pass Date'2013/11/5' to the database, but from the debug info I > found the > database received '2013/10/4' (GMT -8 Timezone) always. It ignored the > Calendar I passed in. > There are some Calcite code a little strange, I have marked by color: > Why setTimestamp and setTime have effective parameter 'calendar', but setDate > ignore the > parameter. Is that the root cause? > AvaticaSite.java > Line 189-199 > public void setTimestamp(Timestamp x, Calendar calendar) { > slots[index] = wrap(ColumnMetaData.Rep.JAVA_SQL_TIMESTAMP, x, calendar); > } > public void setTime(Time x, Calendar calendar) { > slots[index] = wrap(ColumnMetaData.Rep.JAVA_SQL_TIME, x, calendar); > } > public void setDate(Date x, Calendar cal) { > slots[index] = wrap(ColumnMetaData.Rep.JAVA_SQL_DATE, x, calendar); > } -- This message was sent by Atlassian JIRA (v6.3.4#6332)