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/store/alpha/kirby.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.28.0'
- LibPath =
Library path.
File.dirname(__FILE__)
- NotNull =
{ :sql => 'NOT NULL' }.freeze
- Null =
{ :sql => 'NULL' }.freeze
Class Method Summary collapse
-
.escape(str) ⇒ Object
Helper method.
-
.setup(options = {:store => :sqlite}) ⇒ Object
(also: connect, options=, start)
Helper method, useful to initialize Og.
-
.VarChar(size) ⇒ Object
Some useful type macros to help when defining properties.
Class Method Details
.escape(str) ⇒ Object
Helper method.
155 156 157 |
# File 'lib/og.rb', line 155 def escape(str) @@manager.store.escape(str) end |
.setup(options = {:store => :sqlite}) ⇒ Object Also known as: connect, options=, start
Helper method, useful to initialize Og. If no options are passed, sqlite is selected as the default store.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/og.rb', line 120 def setup( = {:store => :sqlite}) begin # 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. [:called_by_og_setup] = true if [:called_by_og_setup].nil? m = @@manager = Manager.new() 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 [:called_by_og_setup] rescue Exception => ex Logger.error "Og.setup had problems: #{ex.class} => #{ex.}" if $DBG Logger.error ex.inspect Logger.error ex.backtrace.join("\n") exit end end 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 |