Sha256: f9f793cdb99c32af8b5b99e244db4848278033d515afd2d5356afefcab2ad9ee

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

#--
# Copyright (c) 2008 Jeremy Hinegardner
# All rights reserved.  See LICENSE and/or COPYING for details.
#++

require 'amalgalite3'
module Amalgalite::SQLite3
  ##
  # module containing all constants used from the SQLite C extension
  #
  module Constants
    ##
    # DataType defines the namespace for all possible SQLite data types.
    # 
    module DataType
    end
    DataType.freeze

    ##
    # Open defines the namespace for all possible flags to the Database.open
    # method
    #
    module Open
    end
    Open.freeze

    ##
    # ResultCode defines the namespace for all possible result codes from an
    # SQLite API call.
    #
    module ResultCode
      #
      # convert an integer value into the string representation of the associated
      # ResultCode constant.
      #
      def self.from_int( value )
        unless @const_map_from_int
          @const_map_from_int = {}
          constants.each do |const_name|
            c_int = const_get( const_name )
            @const_map_from_int[c_int] = const_name
          end
        end
        return @const_map_from_int[ value ]
      end
    end # end ResultCode
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
amalgalite-0.2.0 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.1.0 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.2.1 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.2.3 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.2.2 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.2.4 lib/amalgalite/sqlite3/constants.rb