-VERSION=0.14_15
+VERSION=0.14_16
DISTNAME=bse-$(VERSION)
DISTBUILD=$(DISTNAME)
DISTTAR=../$(DISTNAME).tar
for my $name (@want) {
defined $row->[$names{$name}] or $row->[$names{$name}] = "NULL";
}
- print "Column ",join(",",@$row[@names{@want}]),
+ print "Column ",join(";",@$row[@names{@want}]),
"\n";
}
undef $ti;
#print Dumper(\%indices);
for my $index (sort keys %indices) {
my @sorted = sort { $a->[1] <=> $b->[1] } @{$indices{$index}};
- print "Index $index,$unique{$index},[",
- join(",", map $_->[0], @sorted),
+ print "Index $index;$unique{$index};[",
+ join(";", map $_->[0], @sorted),
"]\n";
}
}
my @order = sort { $b <=> $a } map $_->[1]{$_->[2]}, @kids;
- my $sort = $cgi->param('sort') || 'current';
+ my $sort = join(",", $cgi->param('sort')) || 'current';
+ $sort =~ s/-,/-/g;
my $reverse = $cgi->param('reverse');
my $code;
my @reverse = grep(s/^-// || 0, @fields);
my %reverse;
@reverse{@fields} = @reverse;
- @fields = grep exists($kids[0]{$_}), @fields;
+ @fields = grep exists($kids[0][0]{$_}), @fields;
my @num =
- my %num = map { $_ => 1 } $kids[0]->numeric;
+ my %num = map { $_ => 1 } Article->numeric;
$code =
sub {
$self;
}
+my $get_sql_by_name = 'select sql_statement from sql_statements where name=?';
+
sub stmt {
my ($self, $name) = @_;
$name =~ s/BSE.*:://;
- $statements{$name} or confess "Statement named '$name' not found";
- my $sth = $self->{dbh}->prepare($statements{$name})
+ my $sql = $statements{$name};
+ unless ($sql) {
+ my @row = $self->{dbh}->selectrow_array($get_sql_by_name, {}, $name);
+ if (@row) {
+ $sql = $row[0];
+ print STDERR "Found SQL '$sql'\n";
+ }
+ else {
+ print STDERR "SQL statment $name not found in sql_statements table\n";
+ }
+ }
+ $sql or confess "Statement named '$name' not found";
+ my $sth = $self->{dbh}->prepare($sql)
or croak "Cannot prepare $name statment: ",$self->{dbh}->errstr;
$sth;
}
sub session {
+ $_[0]{session} or die "Session has been deleted already\n";
+
return $_[0]{session};
}
+sub end_request {
+ delete $_[0]{session};
+}
+
sub extra_headers { return }
sub user {
use Carp 'confess';
defined $where or confess 'No url supplied';
-
unless ($where =~ /^\w+:/) {
require BSE::CfgInfo;
my $adminbase = BSE::CfgInfo::admin_base_url($cfg);
my $cellend = '';
my $cellstart = '';
if ($options =~ /=/) {
- $tag .= " " . $options;
+ $tag .= " " . unescape_html($options);
}
elsif ($options =~ /\S/) {
$options =~ s/\s+$//;
or return "<:summary $which No id returned :>";
my $article = $articles->getByPkey($id)
or return "<:summary $which Cannot find article $id:>";
- return $self->summarize($articles, $article->{body},
- $article->{summaryLength}, $acts)
+ return $self->summarize($articles, $article->{body}, $acts,
+ $article->{summaryLength})
},
ifAdmin => sub { $self->{admin} },
=head1 CHANGES
+=head2 0.14_16
+
+=over
+
+=item *
+
+upgrade_mysql.pl now takes a -i filename for the extra table
+structures to be installed. A -h for help option was added too.
+
+=item *
+
+the format of the database structure file for upgrade_mysql.pl has
+changed, to allow for column types containing commas (like
+decimal(9,2)).
+
+=item *
+
+tbe table[htmloption="value" ... ] form of the table body tag no
+longer HTML escapes the options. (#348)
+
+=item *
+
+one of the changes to use the new formatter for summaries mixed up an
+argument order, breaking the <:summary ... :> tag (#347)
+
+=item *
+
+fixed some problems with the new sorting features in reorder.pl.
+
+=item *
+
+BSE::DB::Mysql will now attempt to search the sql_statements table for
+any SQL needed that isn't found in its internal table. This is
+intended for use by external applications using BSE's database support
+tools, specifically for the nport project.
+
+=back
+
=head2 0.14_15
This adds several destabilizing changes, test before using in any
my $verbose;
my $pretend;
my $didbackup;
+my $input = "mysql.str";
+my $wanthelp;
Getopt::Long::Configure('bundling');
GetOptions("v:i", \$verbose,
"n", \$pretend,
- "b", \$didbackup);
+ "b", \$didbackup,
+ "i=s", \$input,
+ "h", \$wanthelp);
$verbose = 1 if defined $verbose && $verbose == 0;
$verbose = 0 unless $verbose;
+help() if $wanthelp;
+
if ($didbackup) {
print "Since you gave the -b option, I assume you made a backup.\n";
}
UNIVERSAL::isa($db, 'BSE::DB::Mysql')
or die "Sorry, this only works for Mysql databases\n";
-open STRUCT, "< mysql.str"
- or die "Cannot open structure file mysql.str: $!\n";
+open STRUCT, "< $input"
+ or die "Cannot open structure file $input: $!\n";
my %tables;
my $table;
while (<STRUCT>) {
if (/^Table\s+([^,]+)/) {
$table = $1;
}
- elsif (/^Column\s+(\w+),([^,]+),(\w*),([^,]*),([^,]*)/) {
+ elsif (/^Column\s+(\w+);([^;]+);(\w*);([^;]*);([^;]*)/) {
$table or die "Column before Table";
push(@{$tables{$table}{cols}},
{
extra=>$5,
});
}
- elsif (/^Index\s+(\w+),(\d+),\[(\w+(?:,\w+)*)\]/) {
+ elsif (/^Index\s+(\w+);(\d+);\[(\w+(?:;\w+)*)\]/) {
$tables{$table}{indices}{$1} =
{
name=>$1,
unique => $2,
- cols => [ split /,/, $3 ],
+ cols => [ split /;/, $3 ],
};
}
else {
my $indices = $tables{$table}{indices};
for my $name (grep $_ ne 'PRIMARY', keys %$indices) {
next if $cindices{$name};
- print "Creating index $name for $table\n" if $verbose;
my $index = $indices->{$name};
+ print "Creating index $name(@{$index->{cols}}) for $table\n" if $verbose;
my $sql = "alter table $table add ";
$sql .= $index->{unique} ? "unique " : "index ";
}
}
-__END__
+sub help {
+ # dump the POD up to the AUTHOR heading
+ while (<DATA>) {
+ last if /^=head1 AUTHOR/;
+ print;
+ }
+ exit;
+}
+
+__DATA__
=head1 NAME
Level 3 prints information useful only to developers.
+=item -i filename
+
+Specify and input filename that isn't mysql.str.
+
+=item -h
+
+Display help.
+
=back
=head1 AUTHOR
--- /dev/null
+# where to install the site
+base_url = http://nport.dh.tp
+securl = http://nportsec.dh.tp
+# where to install the site
+base_dir = /var/www/httpd/nport.dh.tp
+# the database user/password/dsn
+dbuser = nport
+dbpass = nport
+dsn = dbi:mysql:nport
+dbclass = BSE::DB::Mysql
+sessionclass = Apache::Session::MySQL
+# the location of mysql
+mysql = mysql
+basic.access_control=0
+
+site.secureadmin=1