Sha256: 71b8ed406aa9fb4c49dbd9eebd060f46d607f8d86859a714707e98b7775e117c

Contents?: true

Size: 1.97 KB

Versions: 17

Compression:

Stored size: 1.97 KB

Contents

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

require 'amalgalite3'
module Amalgalite::SQLite3
  module Constants
    module Helpers
      #
      # convert an integer value into the string representation of the associated
      # constant. this is a helper method used by some of the other modules
      #
      def name_from_value( value )
        unless @const_map_from_value
          @const_map_from_value = {}
          constants.each do |const_name|
            c_int = const_get( const_name )
            @const_map_from_value[c_int] = const_name
          end
        end
        return @const_map_from_value[ value ]
      end

      #
      # convert a string into the constant value.  This is helper method used by
      # some of the other modules
      #
      def value_from_name( name )
        unless @const_map_from_name
          @const_map_from_name = {}
          constants.each do |const_name|
            c_int = const_get( const_name )
            @const_map_from_name[ const_name ] = c_int
          end
        end
        return @const_map_from_name[ name.upcase ]
      end
    end


    ##
    # 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

    ##
    # Status defines the namespace for all the possible status flags for
    # Amalgalite::SQLite3::Status objects
    #
    module Status
      extend Helpers
    end


    ##
    # DBStatus defines the namespace for all the possible status codes for the
    # Amalgalite::SQlite3::Database::Status objects.
    #
    module DBStatus
      extend Helpers
    end

    ##
    # ResultCode defines the namespace for all possible result codes from an
    # SQLite API call.
    #
    module ResultCode
      extend Helpers
    end # end ResultCode
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
amalgalite-0.5.0-x86-mswin32-60 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.4.2 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.4.2-x86-mswin32-60 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.4.1 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.5.0 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.5.1-x86-mswin32-60 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.5.1 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.7.0 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.6.0-x86-mswin32-60 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.6.0 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.7.0-x86-mswin32-60 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.7.1-x86-mswin32-60 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.7.3 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.7.1 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.7.3-x86-mswin32-60 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.7.4-x86-mswin32-60 lib/amalgalite/sqlite3/constants.rb
amalgalite-0.7.4 lib/amalgalite/sqlite3/constants.rb