<commit_before># encoding: UTF-8
# <NAME> (<EMAIL>)

module JDBCHelper
class Connection
	RUBY_SQL_TYPE_MAP = {
		Fixnum => java.sql.Types::INTEGER,
		Bignum => java.sql.Types::BIGINT,
		String => java.sql.Types::VARCHAR,
		Float  => java.sql.Types::DOUBLE,
		Time   => java.sql.Types::TIMESTAMP
	}

	SETTER_MAP =
	{
		'Java::JavaSql::Date' => :setDate,
		'Java::JavaSql::Time' => :setTime,
		'Java::JavaSql::Timestamp' => :setTimestamp,
		'Time'                     => :setTimestamp,
		'Java::JavaSql::Blob' => :setBinaryStream,

		# Only available when MySQL JDBC driver is loaded.
		# So we use the string representation of the class.
		'Java::ComMysqlJdbc::Blob' => :setBinaryStream

		# FIXME-MORE
	} # :nodoc:

	GETTER_MAP =
	{
		java.sql.Types::TINYINT => :get_int,
		java.sql.Types::SMALLINT => :get_int,
		java.sql.Types::INTEGER => :get_int,
		java.sql.Types::BIGINT => :get_long,

		java.sql.Types::CHAR => :get_string,
		java.sql.Types::VARCHAR => :get_string,
		java.sql.Types::LONGVARCHAR => :get_string,
		(java.sql.Types::NCHAR        rescue nil) => :get_string,
		(java.sql.Types::NVARCHAR     rescue nil) => :get_string,
		(java.sql.Types::LONGNVARCHAR rescue nil) => :get_blob, # FIXME: MySQL
		java.sql.Types::BINARY => :get_string,
		java.sql.Types::VARBINARY => :get_string,
		java.sql.Types::LONGVARBINARY => :get_blob,	# FIXME: MySQL

		java.sql.Types::REAL => :get_double,
		java.sql.Types::FLOAT => :get_float,
		java.sql.Types::DOUBLE => :get_double,
		java.sql.Types::NUMERIC => :get_string, # FIXME: get_big_decimal=no inherent jruby support
		java.sql.Types::DECIMAL => :get_string, # FIXME: get_big_decimal

		java.sql.Types::DATE => :get_date,
		java.sql.Types::TIME => :get_time,
		java.sql.Types::TIMESTAMP => :get_timestamp,

		java.sql.Types::BLOB => :get_blob,
		java.sql.Types::CLOB => :get_string,
		(java.sql.Types::NCLOB rescue nil) => :get_string,

		java.sql.Types::BOOLEAN => :get_boolean
	} # :nodoc:
end#Connection
end#JDBCHelper
<commit_msg>Setters. Up to 10% performance gain for pstmts.<commit_after># encoding: UTF-8
# <NAME> (<EMAIL>)

module JDBCHelper
class Connection
	RUBY_SQL_TYPE_MAP = {
		Fixnum => java.sql.Types::INTEGER,
		Bignum => java.sql.Types::BIGINT,
		String => java.sql.Types::VARCHAR,
		Float  => java.sql.Types::DOUBLE,
		Time   => java.sql.Types::TIMESTAMP
	}

	SETTER_MAP =
	{
		'String' => :setString,
		'Fixnum' => :setInt,
		'Float' => :setDouble,
		# See there's a caveat. Check out ParameterizedStatement#set_param
		'Time' => :setTimestamp,

		'Java::JavaSql::Date' => :setDate,
		'Java::JavaSql::Time' => :setTime,
		'Java::JavaSql::Timestamp' => :setTimestamp,
		'Java::JavaSql::Blob' => :setBinaryStream,

		#########
		# MySQL #
		#########
		# Only available when MySQL JDBC driver is loaded.
		# So we use the string representation of the class.
		'Java::ComMysqlJdbc::Blob' => :setBinaryStream

		# FIXME-MORE
	} # :nodoc:

	GETTER_MAP =
	{
		java.sql.Types::TINYINT => :getInt,
		java.sql.Types::SMALLINT => :getInt,
		java.sql.Types::INTEGER => :getInt,
		java.sql.Types::BIGINT => :getLong,

		java.sql.Types::CHAR => :getString,
		java.sql.Types::VARCHAR => :getString,
		java.sql.Types::LONGVARCHAR => :getString,
		(java.sql.Types::NCHAR        rescue nil) => :getString,
		(java.sql.Types::NVARCHAR     rescue nil) => :getString,
		(java.sql.Types::LONGNVARCHAR rescue nil) => :getBlob, # FIXME: MySQL
		java.sql.Types::BINARY => :getString,
		java.sql.Types::VARBINARY => :getString,
		java.sql.Types::LONGVARBINARY => :getBlob,	# FIXME: MySQL

		java.sql.Types::REAL => :getDouble,
		java.sql.Types::FLOAT => :getFloat,
		java.sql.Types::DOUBLE => :getDouble,
		java.sql.Types::NUMERIC => :getString, # FIXME: get_big_decimal=no inherent jruby support
		java.sql.Types::DECIMAL => :getString, # FIXME: get_big_decimal

		java.sql.Types::DATE => :getDate,
		java.sql.Types::TIME => :getTime,
		java.sql.Types::TIMESTAMP => :getTimestamp,

		java.sql.Types::BLOB => :getBlob,
		java.sql.Types::CLOB => :getString,
		(java.sql.Types::NCLOB rescue nil) => :getString,

		java.sql.Types::BOOLEAN => :getBoolean
	} # :nodoc:
end#Connection
end#JDBCHelper

{'fraction_non_alphanumeric': 0.1754767076997345, 'fraction_numerical': 0.0009654839488293508, 'mean_word_length': 4.34020618556701, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 82, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '510596', 'n_tokens_mistral': 1668, 'n_tokens_neox': 1563, 'n_words': 271}