Gossamer Forum
Quote Reply
creator question
If I want to create a table i can do this:

Code:

my $c = $DB->creator('tablename');

$c->cols(
$col1 => {
type => 'ENUM',
values => ['val1', 'val2' ... ],
not_null => 1
},
$col2 => {
...
}
);

$c->create;


but can i do this and add the fields one at a time?

Code:


my $c = $DB->creator('tablename');

$c->cols('yahger' => {
pos => 1,
type => 'INT'

});

$c->cols('laur' => {
pos => 2,
type => 'INT'

});
$c->create;


I tried and got odd results. I was wondering if it is supported. For what I am writing I need the ability to do one at a time. Would my best bet be to create the table with the first field, then add a new field?

Thanks,

- Jonathan
Quote Reply
Re: [jdgamble] creator question In reply to
Well, since no one has replied to this thread, I will assume it is not possible. For what I was creating, this:

Code:

$c->cols


would not work for creating more than one column at a time. The problem I had is if the program does not know how many new fields there are. So, I ended up using:

Code:

$c->cols

for the first field, and:

Code:

$editor->add_col

for every new field after.

Here is the plugin I was creating:

http://www.gossamer-threads.com/...orum.cgi?post=293017


Hope this helps someone,

- Jonathan