-
Notifications
You must be signed in to change notification settings - Fork 179
/
pg.rb
52 lines (36 loc) · 1.04 KB
/
pg.rb
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
#!/usr/bin/env ruby
begin
require 'pg_ext'
rescue LoadError
# If it's a Windows binary gem, try the <major>.<minor> subdirectory
if RUBY_PLATFORM =~/(mswin|mingw)/i
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
raise
end
end
# The top-level PG namespace.
module PG
# Library version
VERSION = '0.14.0'
# VCS revision
REVISION = %q$Revision$
### Get the PG library version. If +include_buildnum+ is +true+, include the build ID.
def self::version_string( include_buildnum=false )
vstring = "%s %s" % [ self.name, VERSION ]
vstring << " (build %s)" % [ REVISION[/: ([[:xdigit:]]+)/, 1] || '0' ] if include_buildnum
return vstring
end
### Convenience alias for PG::Connection.new.
def self::connect( *args )
return PG::Connection.new( *args )
end
require 'pg/exceptions'
require 'pg/constants'
require 'pg/connection'
require 'pg/result'
end # module PG
# Backward-compatible aliase
PGError = PG::Error