Methods
Included Modules
Public Instance methods
blob(val)

Blobs are actually a lot faster (and use up less storage) for large data I think, as they need not to be encoded and decoded. I’d like to have both ;-) BYTEA is easier to handle than BLOBs, but if you implement BLOBs in a way that they are transparent to the user (as I did in Ruby/DBI), I’d prefer that way.

    # File lib/og/adapter/postgresql/utils.rb, line 20
20:   def blob(val)
21:     val.gsub(/[\000-\037\047\134\177-\377]/) do |b|
22:       "\\#{ b[0].to_s(8).rjust(3, '0') }" 
23:     end
24:   end
escape(str)
    # File lib/og/adapter/postgresql/utils.rb, line 8
 8:   def escape(str)
 9:     return nil unless str
10:     return PGconn.escape(str.to_s)
11:   end
parse_blob(val)
    # File lib/og/adapter/postgresql/utils.rb, line 26
26:   def parse_blob(val)
27:     return '' unless val
28:     
29:     val.gsub(/\\(\\|'|[0-3][0-7][0-7])/) do |s|
30:       if s.size == 2 then s[1,1] else s[1,3].oct.chr end
31:     end
32:   end