Created
March 31, 2023 05:23
-
-
Save auxesis/f3b5e6f0910e21e968a9661059385f40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- ruby -*- | |
# frozen_string_literal: true | |
# The top-level PG namespace. | |
module PG | |
major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or | |
raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}" | |
begin | |
require "#{major_minor}/pg_ext" | |
rescue => e | |
STDERR.puts "Failed to load pg_ext for #{RUBY_VERSION.dump}" | |
exit 1 | |
end | |
# Add a load path to the one retrieved from pg_config | |
add_dll_path.call(POSTGRESQL_LIB_PATH) do | |
if bundled_libpq_path | |
# It's a Windows binary gem, try the <major>.<minor> subdirectory | |
major_minor = RUBY_VERSION[ /^(\d+\.\d+)/ ] or | |
raise "Oops, can't extract the major/minor version from #{RUBY_VERSION.dump}" | |
require "#{major_minor}/pg_ext" | |
else | |
require 'pg_ext' | |
end | |
end | |
class NotAllCopyDataRetrieved < PG::Error | |
end | |
class NotInBlockingMode < PG::Error | |
end | |
# Get the PG library version. | |
# | |
# +include_buildnum+ is no longer used and any value passed will be ignored. | |
def self.version_string( include_buildnum=nil ) | |
"%s %s" % [ self.name, VERSION ] | |
end | |
### Convenience alias for PG::Connection.new. | |
def self.connect( *args, &block ) | |
Connection.new( *args, &block ) | |
end | |
require 'pg/exceptions' | |
require 'pg/constants' | |
require 'pg/coder' | |
require 'pg/binary_decoder' | |
require 'pg/text_encoder' | |
require 'pg/text_decoder' | |
require 'pg/basic_type_registry' | |
require 'pg/basic_type_map_based_on_result' | |
require 'pg/basic_type_map_for_queries' | |
require 'pg/basic_type_map_for_results' | |
require 'pg/type_map_by_column' | |
require 'pg/connection' | |
require 'pg/result' | |
require 'pg/tuple' | |
require 'pg/version' | |
end # module PG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment