Displaying 2 results from an estimated 2 matches for "auto_increment_incr".
2007 Nov 15
4
Using .find_by_sql for database/admin queries
...ing something like this:
@variables = ActiveRecord::Base.find_by_sql "show variables;"
Then, I get stuff like this back (227 elements in @variables) in
script/console:
>> @variables[0]
=> #<ActiveRecord::Base:0x3296eec
@attributes={"Variable_name"=>"auto_increment_increment", "Value"=>"1"}>
However, I''m not sure how to get Variable_name and Value; do I access
this as a Hash element? An attribute?
Should I create a custom Model class such as this?
class MySql < ActiveRecord::Base
Thanks in advance.
--
Posted via ht...
2006 Aug 13
0
Custom id field auto_increment increment and offset?
Hi all,
in mysql, you can set the following environment variables:
set @@auto_increment_offset = 4;
set @@auto_increment_increment =10;
such that:
create table people (id int auto_increment primary key, name char(100));
insert into people set name=''Giuseppe'';
insert into people set name=''Laura'';
select * from people;
+----+----------+
| id | name |
+----+----------+
| 4 | Giusepp...