### Home Classes Methods

### In Files

- lib/dbi/utils.rb
- lib/dbi/utils/xmlformatter.rb
- lib/dbi/utils/tableformatter.rb

### Namespace

- MODULE DBI::Utils::ConvParam
- MODULE DBI::Utils::TableFormatter
- MODULE DBI::Utils::XMLFormatter

### Methods

- ::measure
- ::parse_params

### Files

- README

### Class/Module Index

Quicksearch

- DBI
- DBI::BaseDatabase
- DBI::BaseDriver
- DBI::BaseStatement
- DBI::Binary
- DBI::ColumnInfo
- DBI::DataError
- DBI::DatabaseError
- DBI::DatabaseHandle
- DBI::Date
- DBI::DriverHandle
- DBI::Error
- DBI::Handle
- DBI::HandleTracer
- DBI::IntegrityError
- DBI::InterfaceError
- DBI::InternalError
- DBI::NotImplementedError
- DBI::NotSupportedError
- DBI::OperationalError
- DBI::ProgrammingError
- DBI::Row
- DBI::SQL
- DBI::SQL::PreparedStatement
- DBI::StatementHandle
- DBI::Time
- DBI::Timestamp
- DBI::Type
- DBI::Type::Boolean
- DBI::Type::Decimal
- DBI::Type::Float
- DBI::Type::Integer
- DBI::Type::Null
- DBI::Type::Timestamp
- DBI::Type::Varchar
- DBI::TypeUtil
- DBI::Utils
- DBI::Utils::ConvParam
- DBI::Utils::TableFormatter
- DBI::Utils::XMLFormatter
- DBI::Warning
- Class

No matching classes.

# DBI::Utils

Utility classes and methods for use by both DBDs and consumers.

### Public Class Methods

measure() click to toggle source

Given a block, returns the execution time for the block.

    # File lib/dbi/utils.rb, line 13
    def self.measure
        start = ::Time.now
        yield
        ::Time.now - start
    end

parse_params(str) click to toggle source

parse a string of the form "database=xxx;key=val;..." or database:host and return hash of key/value pairs

Used in DBI.connect and offspring.

    # File lib/dbi/utils.rb, line 25
    def self.parse_params(str)
        # improved by John Gorman <jgorman@webbysoft.com>
        params = str.split(";")
        hash = {}
        params.each do |param|
            key, val = param.split("=")
            hash[key] = val if key and val
        end
        if hash.empty?
            database, host = str.split(":")
            hash['database'] = database if database
            hash['host']     = host if host
        end
        hash
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.