# File lib/amalgalite/column.rb, line 80 def primary_key=( other ) @primary_key = Boolean.to_bool( other ) end
class Amalgalite::Column
a class representing the meta information about an SQLite column, this class serves both for general Schema level information, and for result set information from a SELECT query.
Attributes
the collation sequence name of the column
the database name this column belongs to. This will be 'main' for the main database, 'temp' for the temp database and whatever an attached database was attached as.
the declared data type of the column in the original sql that created the column
the default value of the column. This may not have a value and that either means that there is no default value, or one could not be determined.
the column name
The index (starting with 0) of this column in the table definition or result set
the schema object this column is associated with
the table to which this column belongs
Public Class Methods
Create a column with its name and associated table
# File lib/amalgalite/column.rb, line 50 def initialize( db, table, name, order) @db = db @table = table @name = name @order = Float(order).to_i @declared_data_type = nil @default_value = nil end
Public Instance Methods
set whether or not the column is auto increment
# File lib/amalgalite/column.rb, line 90 def auto_increment=( other ) @auto_increment = Boolean.to_bool( other ) end
true if the column is auto increment
# File lib/amalgalite/column.rb, line 95 def auto_increment? @auto_increment end
true if the column has a default value
# File lib/amalgalite/column.rb, line 60 def has_default_value? not default_value.nil? end
set whether or not the column has a not null constraint
# File lib/amalgalite/column.rb, line 70 def not_null_constraint=( other ) @not_null_constraint = Boolean.to_bool( other ) end
true if the column as a NOT NULL constraint
# File lib/amalgalite/column.rb, line 75 def not_null_constraint? @not_null_constraint end
true if the column may have a NULL value
# File lib/amalgalite/column.rb, line 65 def nullable? @not_null_constraint == false end
set whether or not the column is a primary key column
true if the column is a primary key column
# File lib/amalgalite/column.rb, line 85 def primary_key? @primary_key end