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.30.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.
-
.quote(str) ⇒ Object
Quote the string.
-
.setup(options = {:store => :sqlite}) ⇒ Object
(also: connect, options=, setup=, start)
Helper method, useful to initialize Og.
-
.thread_safe=(bool) ⇒ Object
Change thread_safe mode.
-
.VarChar(size) ⇒ Object
Some useful type macros to help when defining properties.
Class Method Details
.escape(str) ⇒ Object
Helper method.
166 167 168 |
# File 'lib/og.rb', line 166 def escape(str) @@manager.store.escape(str) end |
.quote(str) ⇒ Object
Quote the string.
172 173 174 |
# File 'lib/og.rb', line 172 def quote(str) @@manager.store.quote(str) end |
.setup(options = {:store => :sqlite}) ⇒ 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 150 151 152 153 154 155 156 157 158 |
# File 'lib/og.rb', line 128 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? @@thread_safe = true 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 |
.thread_safe=(bool) ⇒ Object
Change thread_safe mode.
178 179 180 181 182 |
# File 'lib/og.rb', line 178 def thread_safe=(bool) @@thread_safe = bool # @@manager and @@manager.class.managers.each { |m| m.initialize_store } @@thread_safe 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 |