Alex,
A typo in the docs for plugins:
1. Your install needs to add a custom column named 'Review' to
the Links Table To do this we will need a GT::SQL::Editor object.
my $editor = $DB->table ('Links');
unless ($editor->add_col ( 'Review', { type => 'TEXT' }) {
$Plugins::Pluginname::error = "Unable to add column to Links: $GT::SQL::error";
return;
}Note the missing ')' in the 'unless' line.
Also, wouldn't a better example be something like:
my %cols = $table->cols;
if (!(exists $cols{'Review'})) {
my $editor = $DB->editor('Links');
unless ($editor->add_col ( 'Review', { type => 'TEXT' }) ) {
$Plugins::Pluginname::error = "Unable to add column to Links: $GT::SQL::error";
return;
}
} else {
$Plugins::Pluginname::error = "Unable to add column to Links, column already exists";
}PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
A typo in the docs for plugins:
Code:
Examples 1. Your install needs to add a custom column named 'Review' to
the Links Table To do this we will need a GT::SQL::Editor object.
my $editor = $DB->table ('Links');
unless ($editor->add_col ( 'Review', { type => 'TEXT' }) {
$Plugins::Pluginname::error = "Unable to add column to Links: $GT::SQL::error";
return;
}
Also, wouldn't a better example be something like:
Code:
my $table = $DB->table('Links'); my %cols = $table->cols;
if (!(exists $cols{'Review'})) {
my $editor = $DB->editor('Links');
unless ($editor->add_col ( 'Review', { type => 'TEXT' }) ) {
$Plugins::Pluginname::error = "Unable to add column to Links: $GT::SQL::error";
return;
}
} else {
$Plugins::Pluginname::error = "Unable to add column to Links, column already exists";
}
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum