File tree Expand file tree Collapse file tree 1 file changed +1
-111
lines changed
lib/arjdbc/postgresql/base Expand file tree Collapse file tree 1 file changed +1
-111
lines changed Original file line number Diff line number Diff line change @@ -389,114 +389,4 @@ def self.registered_type?(name)
389389 end
390390 end
391391 end
392- end
393-
394- module ActiveRecord
395- module ConnectionAdapters
396- module PostgreSQL
397- module OID
398-
399- remove_const ( :String ) if const_defined? ( :String )
400- class String < Type
401- def type ; :string end
402-
403- def type_cast ( value )
404- return if value . nil?
405-
406- value . to_s
407- end
408- end
409-
410- remove_const ( :Bit ) if const_defined? ( :Bit )
411- class Bit < ActiveRecord ::Type ::Value
412- def type
413- :bit
414- end
415-
416- def type_cast ( value )
417- if ::String === value
418- case value
419- when /^0x/i
420- value [ 2 ..-1 ] . hex . to_s ( 2 ) # Hexadecimal notation
421- else
422- value # Bit-string notation
423- end
424- else
425- value
426- end
427- end
428-
429- def type_cast_for_database ( value )
430- Data . new ( super ) if value
431- end
432-
433- class Data
434- def initialize ( value )
435- @value = value
436- end
437-
438- def to_s
439- value
440- end
441-
442- def binary?
443- /\A [01]*\Z / === value
444- end
445-
446- def hex?
447- /\A [0-9A-F]*\Z /i === value
448- end
449-
450- protected
451-
452- attr_reader :value
453- end
454- end
455-
456- class BitVarying < Bit
457- def type
458- :bit_varying
459- end
460- end
461-
462- class Jsonb < Json
463- def type
464- :jsonb
465- end
466-
467- def changed_in_place? ( raw_old_value , new_value )
468- # Postgres does not preserve insignificant whitespaces when
469- # roundtripping jsonb columns. This causes some false positives for
470- # the comparison here. Therefore, we need to parse and re-dump the
471- # raw value here to ensure the insignificant whitespaces are
472- # consistent with our encoder's output.
473- raw_old_value = type_cast_for_database ( type_cast_from_database ( raw_old_value ) )
474- super ( raw_old_value , new_value )
475- end
476- end
477-
478- class Xml < ActiveRecord ::Type ::String
479- def type
480- :xml
481- end
482-
483- def type_cast_for_database ( value )
484- return unless value
485- Data . new ( super )
486- end
487-
488- class Data # :nodoc:
489- def initialize ( value )
490- @value = value
491- end
492-
493- def to_s
494- @value
495- end
496- end
497- end
498-
499- end
500- end
501- end
502- end if ActiveRecord ::VERSION ::MAJOR > 4 || ActiveRecord ::VERSION ::MINOR >= 2 # >= 4.2
392+ end
You can’t perform that action at this time.
0 commit comments