/usr/lib/ruby/vendor_ruby/sequel/adapters/jdbc/as400.rb is in ruby-sequel 4.1.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | Sequel.require 'adapters/jdbc/transactions'
Sequel.require 'adapters/utils/emulate_offset_with_row_number'
module Sequel
module JDBC
# Database and Dataset support for AS400 databases accessed via JDBC.
module AS400
# Instance methods for AS400 Database objects accessed via JDBC.
module DatabaseMethods
extend Sequel::Database::ResetIdentifierMangling
include Sequel::JDBC::Transactions
TRANSACTION_BEGIN = 'Transaction.begin'.freeze
TRANSACTION_COMMIT = 'Transaction.commit'.freeze
TRANSACTION_ROLLBACK = 'Transaction.rollback'.freeze
# AS400 uses the :as400 database type.
def database_type
:as400
end
# TODO: Fix for AS400
def last_insert_id(conn, opts=OPTS)
nil
end
# AS400 supports transaction isolation levels
def supports_transaction_isolation_levels?
true
end
private
# Use JDBC connection's setAutoCommit to false to start transactions
def begin_transaction(conn, opts=OPTS)
set_transaction_isolation(conn, opts)
super
end
end
# Dataset class for AS400 datasets accessed via JDBC.
class Dataset < JDBC::Dataset
include EmulateOffsetWithRowNumber
WILDCARD = Sequel::LiteralString.new('*').freeze
FETCH_FIRST_ROW_ONLY = " FETCH FIRST ROW ONLY".freeze
FETCH_FIRST = " FETCH FIRST ".freeze
ROWS_ONLY = " ROWS ONLY".freeze
# Modify the sql to limit the number of rows returned
def select_limit_sql(sql)
if l = @opts[:limit]
if l == 1
sql << FETCH_FIRST_ROW_ONLY
elsif l > 1
sql << FETCH_FIRST
literal_append(sql, l)
sql << ROWS_ONLY
end
end
end
def supports_window_functions?
true
end
end
end
end
end
|