Module: Og

Defined in:
lib/og.rb,
lib/og/store.rb,
lib/og/types.rb,
lib/og/entity.rb,
lib/og/errors.rb,
lib/og/manager.rb,
lib/og/markers.rb,
lib/og/relation.rb,
lib/og/evolution.rb,
lib/og/store/sql.rb,
lib/og/collection.rb,
lib/og/store/kirby.rb,
lib/og/relation/has_one.rb,
lib/og/relation/has_many.rb,
lib/og/relation/refers_to.rb,
lib/og/store/alpha/memory.rb,
lib/og/relation/belongs_to.rb,
lib/og/relation/joins_many.rb,
lib/og/store/alpha/filesys.rb,
lib/og/relation/many_to_many.rb,
lib/og/store/alpha/sqlserver.rb,
lib/og/store/sqlite2.rb,
lib/og/store/sqlite.rb,
lib/og/store/mysql.rb

Overview

class Sqlserver::Result

def blank?
  0 == num_rows
end

alias_method :next, :fetch_row  

def each_row
  each do |row|
    yield(row, 0)
  end
end

def first_value
  val = fetch_row[0]
  free
  return val
end

alias_method :close, :free

end

Defined Under Namespace

Modules: EntityMixin, MemoryUtils, MysqlUtils, RelationDSL, SchemaInheritanceBase, SqlUtils, SqlserverUtils, Unmanageable Classes: BelongsTo, Blob, Collection, Entity, FilesysStore, HasMany, HasManyCollection, HasOne, JoinsMany, JoinsManyCollection, KirbyStore, Manager, ManyToMany, MemoryStore, MysqlStore, RefersTo, Relation, SqlStore, Sqlite2Store, SqliteStore, SqlserverStore, Store, StoreException

Constant Summary collapse

Version =

The version.

'0.31.0'
LibPath =

Library path.

File.dirname(__FILE__)
NotNull =
{ :sql => 'NOT NULL' }.freeze
Null =
{ :sql => 'NULL' }.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.managerObject

The active manager



118
119
120
# File 'lib/og.rb', line 118

def manager
  @manager
end

.thread_safeObject

thread safe state



122
123
124
# File 'lib/og.rb', line 122

def thread_safe
  @thread_safe
end

Class Method Details

.escape(str) ⇒ Object

Helper method.



157
158
159
# File 'lib/og.rb', line 157

def escape(str)
  @manager.store.escape(str)
end

.quote(str) ⇒ Object

Quote the string.



163
164
165
# File 'lib/og.rb', line 163

def quote(str)
  @manager.store.quote(str)
end

.setup(options = {}) ⇒ Object Also known as: connect, options=, setup=, start

Helper method, useful to initialize Og. If no options are passed, sqlite is selected as the default store.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/og.rb', line 128

def setup(options = {})
    options={:store => :sqlite}.update(options)
    # This is a flag a store or manager can use to determine
    # if it was being called by Og.setup to provide
    # additional, faster or enhanced functionality.

    options[:called_by_og_setup] = true if options[:called_by_og_setup].nil?

    @thread_safe = options.fetch(:thread_safe, true)

    m = @manager = Manager.new(options)        
    m.manage_classes

    # Allows functionality that requires a store is 
    # finalized to be implemented. A vastly superior 
    # method of constructing foreign key constraints is an 
    # example of functionality this provides. Currently 
    # only used by the PostgreSQL store.
    
    m.post_setup if options[:called_by_og_setup]
  return m
end

.VarChar(size) ⇒ Object

Some useful type macros to help when defining properties. You can easily code your own type macros. Just return the array that should be passed to the property macro.

Example

property :name, VarChar(30)



11
12
13
# File 'lib/og/types.rb', line 11

def self.VarChar(size)
  return String, :sql => "VARCHAR(#{size})"
end