Skip to content

Commit

Permalink
Do not use SQL states for exceptions in jdbc/sqlanywhere adapter
Browse files Browse the repository at this point in the history
The sqlanywhere JDBC driver (or SQLAnywhere itself) has broken
SQL State handling, using 23000 for most constraint exceptions.
Changes made in 813db79 to
make the jdbc adapter consider SQL states of the current
exception resulted in the use of SQL states in the
jdbc/sqlanywhere, where they didn't work correctly.  Explicitly
mark the jdbc/sqlanywhere adapter to not handle SQL states.
The shared sqlanywhere adapter handles the exception mapping
correctly in this case.
  • Loading branch information
jeremyevans committed Oct 31, 2023
1 parent 44f6b8b commit cddac82
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/sequel/adapters/jdbc/sqlanywhere.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ module DatabaseMethods

private

def database_exception_use_sqlstates?
false
end

# Use @@IDENTITY to get the last inserted id
def last_insert_id(conn, opts=OPTS)
statement(conn) do |stmt|
Expand Down

0 comments on commit cddac82

Please sign in to comment.