| Class | Amalgalite::Column |
| In: |
lib/amalgalite/column.rb
|
| Parent: | Object |
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.
| auto_increment | [RW] | true if the column is AUTO INCREMENT, false otherwise |
| collation_sequence_name | [RW] | the collation sequence name of the column |
| db | [RW] | the database name this column belongs to |
| declared_data_type | [RW] | the declared data type of the column in the original sql that created the column |
| default_value | [RW] | 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. |
| name | [RW] | the column name |
| not_null_constraint | [RW] | true if the column has a NOT NULL constraint, false otherwise |
| primary_key | [RW] | true if the column is part of a primary key, false otherwise |
| schema | [RW] | the schema object this column is associated with |
| table | [RW] | the table to which this column belongs |
Create a column with its name and associated table
# File lib/amalgalite/column.rb, line 53
53: def initialize( db, table, name)
54: @db = db
55: @name = name
56: @table = table
57: @declared_data_type = nil
58: @default_value = nil
59: end
true if the column is auto increment
# File lib/amalgalite/column.rb, line 82
82: def auto_increment?
83: auto_increment
84: end
true if the column has a default value
# File lib/amalgalite/column.rb, line 62
62: def has_default_value?
63: not default_value.nil?
64: end
true if the column as a NOT NULL constraint
# File lib/amalgalite/column.rb, line 72
72: def not_null_constraint?
73: not_null_constraint
74: end
true if the column may have a NULL value
# File lib/amalgalite/column.rb, line 67
67: def nullable?
68: not_null_constraint == false
69: end