1. 12 Sep, 2017 1 commit
  2. 10 Sep, 2017 3 commits
  3. 03 Sep, 2017 4 commits
  4. 01 Sep, 2017 1 commit
  5. 22 Aug, 2017 4 commits
  6. 06 Aug, 2017 2 commits
  7. 31 Jul, 2017 1 commit
  8. 30 Jul, 2017 1 commit
  9. 25 Jul, 2017 3 commits
  10. 21 Jul, 2017 10 commits
    • Vadim Zeitlin's avatar
      Merge branch 'odbc-string-len' · 7a6559c1
      Vadim Zeitlin authored
      Fix handling of strings in bulk operations in ODBC and DB2 backends and
      get_affected_rows() behaviour in ODBC.
      
      Closes #561, also see #202, #495.
      7a6559c1
    • Vadim Zeitlin's avatar
      Add test checking string length when using bulk insert · c6aef12b
      Vadim Zeitlin authored
      This used to be broken, so add a test to check that it works after the
      changes of the last commit and to avoid breaking it again.
      c6aef12b
    • Vadim Zeitlin's avatar
      Fix the length of strings in DB2 vector operations · 51c4c1e1
      Vadim Zeitlin authored
      This is the same as a2c1ce7aceb564c11f48b3b586e2e77245c3deab except for
      DB2 backend (which is, of course, very similar to ODBC one as ODBC API
      is very close to DB2 CLI).
      51c4c1e1
    • Vadim Zeitlin's avatar
      Fix the length of strings in ODBC vector operations · be4f26fe
      Vadim Zeitlin authored
      Saving a string of length N in the database saved it as a string of
      length N+1 with a trailing NUL explicitly written into the database and
      reading it back resulted in a string of length N+1 too, i.e. it didn't
      survive the round trip (notice that this bug only affected vector
      operations, scalar ones worked correctly).
      
      Fix this by not writing the trailing NUL in odbc_vector_use_type_backend
      and fix the strings returned from odbc_vector_into_type_backend by not
      assuming that they're NUL-terminated any more: in fact, they can be, but
      they also can be right-padded with spaces, which need to be removed.
      
      Notice that this does mean that we still have a problem with
      inconsistent behaviour for the strings with the trailing spaces between
      ODBC backend and others: ODBC one will strip them from the returned
      strings, but other backends will not. It is not clear what can be done
      about it, unfortunately.
      be4f26fe
    • Vadim Zeitlin's avatar
      Improve get_affected_rows() documentation · 521a8408
      Vadim Zeitlin authored
      Mention that the exact result of this method can't be relied upon for
      the partially successful statements when using ODBC: some drivers
      (including the widely used MS SQL native client) simply don't return
      this information at all, while others (MySQL) just return wrong number
      of rows.
      
      Also remove the apparently obsolete note about this method not supported
      in the Oracle backend as it does seem to implement it.
      521a8408
    • Vadim Zeitlin's avatar
      Return -1 from get_affected_rows() in ODBC backend if unknown · e7e7fb78
      Vadim Zeitlin authored
      It is not always possible to get the number of affected rows after a
      partially executed statement, some drivers provide this information, but
      some others, notable MS SQL native client one, do not.
      
      Return -1 from get_affected_rows() to at least allow distinguishing this
      situation from the one in which we can really know that no rows were
      affected, in which case 0 would be returned.
      
      Notice that this indirectly fixes the "Get affected rows" unit test
      which was broken by the previous fix of #495 as it made the partial
      insert actually work, while it was completely broken before because
      "1\0" string couldn't be converted to a number and so the check for
      get_affected_rows() wasn't being executed at all. But now that the
      string is the correct "1", the check started being executed and failing.
      e7e7fb78
    • Vadim Zeitlin's avatar
      Remove loop that could be never executed from ODBC code · 97a4728c
      Vadim Zeitlin authored
      The hasVectorUseElements_ field is guaranteed to be false in the "else"
      branch of "if (hasVectorUseElements_)" condition, so the loop condition
      testing it could never be true.
      
      Simplify code by getting rid of the loop, without changing its
      behaviour.
      97a4728c
    • Vadim Zeitlin's avatar
      Fix harmless variable shadowing warnings · 1a0eeb18
      Vadim Zeitlin authored
      Suppress VC14 (a.k.a. MSVS 2015) C4456 warning about shadowing variables
      in outer scope.
      
      No real changes.
      1a0eeb18
    • Vadim Zeitlin's avatar
      Fix loss of error message in ODBC backend when using vectors · e7cdd475
      Vadim Zeitlin authored
      The error message needs to be retrieved before calling any other ODBC
      functions, but the code called SQLGetDiagField() and so the error
      message always was "No error" even if the statement really failed.
      e7cdd475
    • Vadim Zeitlin's avatar
      Add check for absence of unneeded truncation too · 06915e48
      Vadim Zeitlin authored
      We already checked that inserting a too long string resulted in an
      error, now check that inserting a string just long enough does not
      result in it.
      06915e48
  11. 20 Jul, 2017 7 commits
    • Vadim Zeitlin's avatar
    • Vadim Zeitlin's avatar
      Return int, not long, from parse10() helper · 56bc9f9c
      Vadim Zeitlin authored
      Add a check for integer overflow and return an int value, long is not
      necessary for date/time components and passing it to
      mktime_from_ymdhms() later resulted in implicit conversion from long to
      int and even broke iOS compilation, apparently.
      
      Closes #506.
      56bc9f9c
    • Vadim Zeitlin's avatar
      Check for negative date components in parse10() · 281f54f5
      Vadim Zeitlin authored
      Using them in mktime() later would fail anyhow, but here we can give a
      slightly better error message.
      281f54f5
    • Vadim Zeitlin's avatar
      Don't pass exception message to parse10() helper · f2e84c4b
      Vadim Zeitlin authored
      It doesn't make much sense to use a variable for this message when it is
      actually always the same. Just use the literal string in the function
      itself.
      
      Try to make the message more clear by explaining why did the error occur
      more precisely.
      f2e84c4b
    • Vadim Zeitlin's avatar
      Avoid duplicate code for parsing dates in different backends · a1e07e38
      Vadim Zeitlin authored
      SQLite, MySQL and PostgreSQL backends used the same but slightly
      different code for parsing the contents of a buffer into std::tm struct.
      
      Replace all these different versions with a single version, copied from
      the PostgreSQL variant, which seems like the most complete, in the
      common code.
      
      Update MySQL-specific test to not expect parsing a string containing
      time without date to yield year 2000, this didn't make any sense at all
      and PostgreSQL default of year 1900 makes at least slightly more sense.
      a1e07e38
    • Vadim Zeitlin's avatar
      Fix libraries link order when linking tests statically · e2f1ca53
      Vadim Zeitlin authored
      Link with the backend (static) library first, then with the core
      library in order to ensure that the backend library can use functions
      defined in the core library even if they are not used by the core
      library itself: previously, such functions would be discarded by a
      traditional Unix linker when processing the core library because they
      wouldn't be referenced and then be missing, resulting in link errors,
      when it processes the backend library.
      
      This will allow sharing some code between the backends in the upcoming
      commit.
      e2f1ca53
    • Vadim Zeitlin's avatar
      Fix unused parameter warnings in Oracle backend code · a3685fd0
      Vadim Zeitlin authored
      No real changes.
      a3685fd0
  12. 19 Jul, 2017 3 commits