<!--
RSS generated by JIRA (4.4#649-r158309) at Wed Jun 19 03:06:41 CDT 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://dev.clojure.org/jira/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+10021+AND+labels+%3D+bug&tempMax=1000&field=key&field=summary
-->
<!-- If you wish to do custom client-side styling of RSS, uncomment this:
<?xml-stylesheet href="http://dev.clojure.org/jira/styles/jiraxml2html.xsl" type="text/xsl"?>
-->
<rss version="0.92">
    <channel>
        <title>Clojure JIRA</title>
        <link>http://dev.clojure.org/jira/secure/IssueNavigator.jspa?reset=true&amp;jqlQuery=project+%3D+10021+AND+labels+%3D+bug</link>
        <description>An XML representation of a search request</description>
                <language>en-us</language>
                        <issue start="0" end="4" total="4"/>
                <build-info>
            <version>4.4</version>
            <build-number>649</build-number>
            <build-date>25-07-2011</build-date>
        </build-info>
<item>
            <title>[JDBC-50] insert-rows (incorrectly) patches incomplete records</title>
                <link>http://dev.clojure.org/jira/browse/JDBC-50</link>
                <project id="10021" key="JDBC">java.jdbc</project>
                        <description>&lt;p&gt;When using sql/insert-rows with a dataset that contains incomplete rows the rows will be patched with values from the preceding rows. The behaviour to be expected is not documented.&lt;/p&gt;

&lt;p&gt;I would expect insert-rows either only accepts complete rows. When accepting incomplete rows I would expect patching with nil-values instead of values from other rows.&lt;/p&gt;

&lt;p&gt;Attached you find an example and the output when running in comments.&lt;/p&gt;
</description>
                <environment>Postgres database on Debian machine</environment>
            <key id="16098">JDBC-50</key>
            <summary>insert-rows (incorrectly) patches incomplete records</summary>
                <type id="1" iconUrl="http://dev.clojure.org/jira/images/icons/bug.gif">Defect</type>
                                <priority id="3" iconUrl="http://dev.clojure.org/jira/images/icons/priority_major.gif">Major</priority>
                    <status id="5" iconUrl="http://dev.clojure.org/jira/images/icons/status_resolved.gif">Resolved</status>
                    <resolution id="1">Completed</resolution>
                                <assignee username="seancorfield">Sean Corfield</assignee>
                                <reporter username="cvkemenade">Cees van Kemenade</reporter>
                        <labels>
                        <label>bug</label>
                        <label>docs</label>
                    </labels>
                <created>Thu, 21 Mar 2013 13:38:32 -0500</created>
                <updated>Sat, 6 Apr 2013 15:38:46 -0500</updated>
                    <resolved>Sat, 6 Apr 2013 15:38:46 -0500</resolved>
                                                                    <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="30886" author="seancorfield" created="Sat, 6 Apr 2013 15:10:42 -0500"  >&lt;p&gt;This looks like an old / long-standing bug that no one has run into before.&lt;/p&gt;

&lt;p&gt;In the new (soon-to-be 0.3.0) release, (clojure.java.jdbc.sql/insert :table &lt;span class=&quot;error&quot;&gt;&amp;#91;1 1&amp;#93;&lt;/span&gt; &lt;span class=&quot;error&quot;&gt;&amp;#91;2&amp;#93;&lt;/span&gt; []) would throw an exception:&lt;/p&gt;

&lt;p&gt;IllegalArgumentException insert called with inconsistent number of columns / values  clojure.java.jdbc.sql/insert-multi-row (sql.clj:116)&lt;/p&gt;

&lt;p&gt;I will update clojure.java.jdbc/insert-rows to throw a similar exception.&lt;/p&gt;</comment>
                    <comment id="30887" author="seancorfield" created="Sat, 6 Apr 2013 15:38:46 -0500"  >&lt;p&gt;Fixed in 0.3.0-SNAPSHOT by throwing an exception if the value-groups are not all the same length.&lt;/p&gt;

&lt;p&gt;Currently relies on the DB to trap column names not matching value groups (which is known not to work on SQLite but does work on other DBs as far as I know).&lt;/p&gt;

&lt;p&gt;insert-rows is deprecated in 0.3.0 - use insert! instead going  forward (which does more validation).&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11922" name="jdbcIssue.clj" size="855" author="cvkemenade" created="Thu, 21 Mar 2013 13:38:32 -0500" />
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                                                                            <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Global Rank</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                                                                                            </customfields>
    </item>

<item>
            <title>[JDBC-49] jdbc insert-records can not handle spaces in columnames</title>
                <link>http://dev.clojure.org/jira/browse/JDBC-49</link>
                <project id="10021" key="JDBC">java.jdbc</project>
                        <description>
&lt;p&gt;If a database contains column-names that include spaces an sql/insert-record will fail. However, inserting via sql/do-commands or sql/insert-rows works as expected.&lt;/p&gt;

&lt;p&gt;Attached you find a file showing the error.&lt;/p&gt;</description>
                <environment>Postgres on Debian</environment>
            <key id="16099">JDBC-49</key>
            <summary>jdbc insert-records can not handle spaces in columnames</summary>
                <type id="1" iconUrl="http://dev.clojure.org/jira/images/icons/bug.gif">Defect</type>
                                <priority id="3" iconUrl="http://dev.clojure.org/jira/images/icons/priority_major.gif">Major</priority>
                    <status id="5" iconUrl="http://dev.clojure.org/jira/images/icons/status_resolved.gif">Resolved</status>
                    <resolution id="1">Completed</resolution>
                                <assignee username="seancorfield">Sean Corfield</assignee>
                                <reporter username="cvkemenade">Cees van Kemenade</reporter>
                        <labels>
                        <label>bug</label>
                    </labels>
                <created>Thu, 21 Mar 2013 13:42:35 -0500</created>
                <updated>Sat, 6 Apr 2013 16:14:41 -0500</updated>
                    <resolved>Sat, 6 Apr 2013 16:14:41 -0500</resolved>
                                                                    <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="30802" author="cvkemenade" created="Fri, 22 Mar 2013 01:21:00 -0500"  >&lt;p&gt;Further analysis based on a suggestion of Sean leads to:&lt;/p&gt;

&lt;p&gt;It seems to be that there is an issue in the naming-strategy in this issue. Either in the way I define it of the way it is implemented&lt;br/&gt;
 (sql/with-connection db&lt;br/&gt;
       (sql/with-naming-strategy {:keyword identity :entity (fn &lt;span class=&quot;error&quot;&gt;&amp;#91;x&amp;#93;&lt;/span&gt; (str \&quot; x \&quot;))}&lt;br/&gt;
        ...&lt;br/&gt;
))&lt;/p&gt;

&lt;p&gt;When I remove the naming-strategy and replace the offending insert by a manual quoting strategy via&lt;br/&gt;
 (sql/insert-records  &quot;test_jdbc_naming3&quot; {((fn [x] (str \&quot; x \&quot;)) &quot;b- b&quot;) 7})&lt;br/&gt;
which corresponds to&lt;br/&gt;
(sql/insert-records  &quot;test_jdbc_naming3&quot; {&quot;\&quot;b- b\&quot;&quot; 7})&lt;br/&gt;
then the code runs fine.&lt;/p&gt;

&lt;p&gt;So the issue is located in the handling of the naming-strategy, or in the way I defined the naming-strategy (for postgres).&lt;/p&gt;</comment>
                    <comment id="30888" author="seancorfield" created="Sat, 6 Apr 2013 16:14:41 -0500"  >&lt;p&gt;Fixed in 0.3.0-SNAPSHOT by wiring &lt;b&gt;as-str&lt;/b&gt; variable into compatibility layer as :entities argument.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11924" name="jdbcIssue2.clj" size="2615" author="cvkemenade" created="Thu, 21 Mar 2013 14:35:07 -0500" />
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                                                                            <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Global Rank</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                                                                                            </customfields>
    </item>

<item>
            <title>[JDBC-35] Wrong timezone for java.sql.Date, java.sql.Time and java.sql.Timestamp objects returned by with-query-results</title>
                <link>http://dev.clojure.org/jira/browse/JDBC-35</link>
                <project id="10021" key="JDBC">java.jdbc</project>
                        <description>&lt;p&gt;Our database stores date and time related information in UTC. But, the results from &lt;tt&gt;with-query-results&lt;/tt&gt; creates objects in the local timezone. This is causing a lot of unexpected behavior when constructing Joda &lt;tt&gt;DateTime&lt;/tt&gt; objects in &lt;tt&gt;clj-time&lt;/tt&gt;.  Currently, the &lt;tt&gt;with-query-results&lt;/tt&gt; function is using the single argument getter functions in the &lt;tt&gt;ResultSet&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;	&lt;tt&gt;getDate(int columnIndex)&lt;/tt&gt;&lt;br/&gt;
	&lt;tt&gt;getTime(int columnIndex)&lt;/tt&gt;&lt;br/&gt;
	&lt;tt&gt;getTimestamp(int columnIndex)&lt;/tt&gt; &lt;/p&gt;

&lt;p&gt;We can solve this problem if we can optionally pass the timezone information and call the two argument getter functions.&lt;/p&gt;

&lt;p&gt;	&lt;tt&gt;getDate(int columnIndex, Calendar cal)&lt;/tt&gt; &lt;br/&gt;
	&lt;tt&gt;getTime(int columnIndex, Calendar cal)&lt;/tt&gt; &lt;br/&gt;
	&lt;tt&gt;getTimestamp(int columnIndex, Calendar cal)&lt;/tt&gt;&lt;/p&gt;</description>
                <environment></environment>
            <key id="15583">JDBC-35</key>
            <summary>Wrong timezone for java.sql.Date, java.sql.Time and java.sql.Timestamp objects returned by with-query-results</summary>
                <type id="1" iconUrl="http://dev.clojure.org/jira/images/icons/bug.gif">Defect</type>
                                <priority id="3" iconUrl="http://dev.clojure.org/jira/images/icons/priority_major.gif">Major</priority>
                    <status id="5" iconUrl="http://dev.clojure.org/jira/images/icons/status_resolved.gif">Resolved</status>
                    <resolution id="2">Declined</resolution>
                                <assignee username="seancorfield">Sean Corfield</assignee>
                                <reporter username="jestinepaul">Jestine Paul</reporter>
                        <labels>
                        <label>bug</label>
                    </labels>
                <created>Fri, 20 Jul 2012 10:31:09 -0500</created>
                <updated>Wed, 12 Sep 2012 20:01:37 -0500</updated>
                    <resolved>Wed, 12 Sep 2012 20:01:37 -0500</resolved>
                                                                    <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="29016" author="seancorfield" created="Sat, 21 Jul 2012 01:30:19 -0500"  >&lt;p&gt;Can you provide a self-contained test case? Lots of people are using java.jdbc in production without running into this problem, and at World Singles we&apos;ve had this in production for a long time in a high traffic environment without seeing any problems with timezones. Dates go in and out of the database unchanged, which is exactly as expected - and we have databases running in three different timezones.&lt;/p&gt;</comment>
                    <comment id="29017" author="jestinepaul" created="Sat, 21 Jul 2012 05:29:05 -0500"  >&lt;p&gt;I have added a new test and it is failing with my Postgresql.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/jestinepaul/java.jdbc/commit/195397b1b2a0245d2439ab9963fe2138450a27f3&quot;&gt;https://github.com/jestinepaul/java.jdbc/commit/195397b1b2a0245d2439ab9963fe2138450a27f3&lt;/a&gt;&lt;/p&gt;</comment>
                    <comment id="29020" author="seancorfield" created="Sat, 21 Jul 2012 13:03:48 -0500"  >&lt;p&gt;Looking at recommended practices out there, such as listed here: &lt;a href=&quot;http://stackoverflow.com/questions/2532729/daylight-saving-time-and-timezone-best-practices&quot;&gt;http://stackoverflow.com/questions/2532729/daylight-saving-time-and-timezone-best-practices&lt;/a&gt; one important thing is: &quot;On Servers, set hardware clocks and OS clocks to UTC. Use NTP services on all servers.&quot; The same advice is repeated here: &lt;a href=&quot;http://www.dbspecialists.com/blog/database-theory/intelligent-date-handling/&quot;&gt;http://www.dbspecialists.com/blog/database-theory/intelligent-date-handling/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Looking further into PostgreSQL (a database I generally don&apos;t use), I see this: &lt;a href=&quot;http://stackoverflow.com/questions/6151084/which-timestamp-type-to-choose-in-a-postgresql-database&quot;&gt;http://stackoverflow.com/questions/6151084/which-timestamp-type-to-choose-in-a-postgresql-database&lt;/a&gt; which seems to contain a lot of PostgreSQL-specific stuff. However, that article makes it clear that you need to set the database timezone to UTC in order to SELECT timestamp columns correctly.&lt;/p&gt;

&lt;p&gt;In my opinion, the behavior you&apos;re seeing is not a bug (in java.jdbc) but an artifact of your environment being set up incorrectly. I&apos;ll leave this ticket open for a little while for more discussion but without a concrete patch that is shown to not affect other use cases, I will close this ticket by the end of August.&lt;/p&gt;</comment>
                    <comment id="29033" author="jestinepaul" created="Mon, 23 Jul 2012 13:26:04 -0500"  >&lt;p&gt;As mentioned earlier, the database server timezone is in UTC and the JDBC library runs on a client machine set to local time. If the database has a date value of 2012-7-23, it changes to 2012-7-22 on the client side (if the client is running at timezone greater than UTC) when coerced using &lt;tt&gt;to-date-time&lt;/tt&gt; in &lt;tt&gt;clj-time&lt;/tt&gt;. This is extremely dangerous and is not specific to any database. I noticed it first on Sybase Enterprise Server and I have now also replicated it in the test case with Postgresql.&lt;/p&gt;

&lt;p&gt;I have attached a patch which fixes this problem by passing in an optional parameter. The test case is also modified to use &lt;tt&gt;clj-time&lt;/tt&gt;, as it expresses the problem more clearly. Please let me know if you need any more clarification.&lt;/p&gt;

&lt;p&gt;p.s. I have already mailed the CA and should reach Durham in a few days.&lt;/p&gt;</comment>
                    <comment id="29431" author="seancorfield" created="Wed, 12 Sep 2012 20:01:26 -0500"  >&lt;p&gt;Since the proposed patch requires the user to pass in a list of columns to treat specially - and reorders columns in results and adds some performance overhead for all users, not just those wanting to adjust column values - I believe users who choose to run JDBC clients in timezones different to the database, against the widely-listed best practice recommendations, should bear the burden of adjusting the columns themselves in their own client code. Since they already know which columns to adjust and they know the difference between UTC and local time, they should be able to make the adjustments easily enough as part of post-processing the resultset-seq.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11394" name="resultset-timezone.diff" size="7215" author="jestinepaul" created="Mon, 23 Jul 2012 13:24:52 -0500" />
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                                                                            <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Global Rank</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                                                                                            </customfields>
    </item>

<item>
            <title>[JDBC-33] update-or-insert does not work with oracle</title>
                <link>http://dev.clojure.org/jira/browse/JDBC-33</link>
                <project id="10021" key="JDBC">java.jdbc</project>
                        <description>&lt;p&gt;According to the &lt;a href=&quot;http://docs.oracle.com/cd/B28359_01/java.111/b31224/oraperf.htm#autoId17&quot;&gt;oracle documentation&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;For a prepared statement batch, it is not possible to know the number of rows affected in the database by each individual statement in the batch. Therefore, all array elements have a value of -2. According to the JDBC 2.0 specification, a value of -2 indicates that the operation was successful but the number of rows affected is unknown.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;As documented update-values returns (-2) which means that the (if (zero?)) check in update-or-insert-values will never return true.&lt;/p&gt;

&lt;p&gt;Oracle does provide the number of rows updated via an the method &lt;a href=&quot;http://docs.oracle.com/javase/6/docs/api/java/sql/Statement.html#getUpdateCount()&quot;&gt;getUpdateCount&lt;/a&gt; on instances of Statement.&lt;/p&gt;

&lt;p&gt;The following change fixes this problem for oracle users, but I am not sure how it will affect other drivers.&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-none&quot;&gt;(defn oracle-do-prepared
  &quot;Executes an (optionally parameterized) SQL prepared statement on the                                           
  open database connection. Each param-group is a seq of values for all of                                        
  the parameters.                                                                                                 
  Return a seq of update counts (one count for each param-group).&quot;
  [sql &amp;amp; param-groups]
  (with-open [^PreparedStatement stmt (prepare-statement (connection) sql)]
    (if (empty? param-groups)
      (transaction* (&#402; [] (vector (.executeUpdate stmt))))
      (do
        (doseq [param-group param-groups]
          (set-parameters stmt param-group)
          (.addBatch stmt))
        (transaction* (&#402; [] (let [result (.executeBatch stmt)
                                  count  (.getUpdateCount stmt)]
                              (vector count))))))))&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>clojure 1.3.0&lt;br/&gt;
clojure.java.jdbc 0.2.1&lt;br/&gt;
oracle 10.2.0.4.0</environment>
            <key id="15461">JDBC-33</key>
            <summary>update-or-insert does not work with oracle</summary>
                <type id="1" iconUrl="http://dev.clojure.org/jira/images/icons/bug.gif">Defect</type>
                                <priority id="4" iconUrl="http://dev.clojure.org/jira/images/icons/priority_minor.gif">Minor</priority>
                    <status id="5" iconUrl="http://dev.clojure.org/jira/images/icons/status_resolved.gif">Resolved</status>
                    <resolution id="1">Completed</resolution>
                                <assignee username="seancorfield">Sean Corfield</assignee>
                                <reporter username="btatnall">Brian Tatnall</reporter>
                        <labels>
                        <label>bug</label>
                    </labels>
                <created>Mon, 21 May 2012 10:16:40 -0500</created>
                <updated>Sun, 10 Jun 2012 18:13:59 -0500</updated>
                    <resolved>Sun, 10 Jun 2012 18:13:59 -0500</resolved>
                                                                    <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="28560" author="seancorfield" created="Tue, 22 May 2012 00:17:49 -0500"  >&lt;p&gt;Interesting. (.getUpdateCount stmt) is a standard part of the JDBC API so it looks reasonable to see if the result of the (.executeBatch stmt) is a single sequence with a -2 value, the code could call (.getUpdateCount stmt) and return that (single) value as a sequence. It looks like that should be completely portable but it will be hard to test since none of the other DBs return -2 as far as I know and I don&apos;t have an Oracle install to test against &lt;img class=&quot;emoticon&quot; src=&quot;http://dev.clojure.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                                                                            <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Global Rank</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                                                                                            </customfields>
    </item>
</channel>
</rss>