https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24005
--- Comment #4 from Andrew Lau <andrewanan...@gmail.com> --- Many thanks for the very practical advice! I removed the instance and attempted reinstalling it. Now the following error message occurs: ----------------------------------------- The following error occurred while importing the database structure: [Tue Nov 12 12:04:18 2019] install.pl: DBD::mysql::st execute failed: BLOB, TEXT, GEOMETRY or JSON column 'changed_fields' can't have a default value at /usr/share/perl5/DBIx/RunSQL.pm line 273. Please contact your system administrator ------------------------------------------------------------ The /usr/share/perl5/DBIx?RunSQL.pm looks like this: -------------------------------------------------------------- GNU nano 2.9.3 /usr/share/perl5/DBIx/RunSQL.pm package DBIx::RunSQL; use strict; use DBI; use vars qw($VERSION); $VERSION = '0.15'; =head1 NAME DBIx::RunSQL - run SQL from a file =cut =head1 SYNOPSIS #!/usr/bin/perl -w use strict; use lib 'lib'; use DBIx::RunSQL; my $test_dbh = DBIx::RunSQL->create( dsn => 'dbi:SQLite:dbname=:memory:', sql => 'sql/create.sql', force => 1, verbose => 1, ); ... # run your tests with a DB setup fresh from setup.sql =head1 METHODS =head2 C<< DBIx::RunSQL->create ARGS >> =head2 C<< DBIx::RunSQL->run ARGS >> Runs the SQL commands and returns the database handle. In list context, it returns the database handle and the suggested exit code. =over 4 =item * C<sql> - name of the file containing the SQL statements The default is C<sql/create.sql> If C<sql> is a reference to a glob or a filehandle, the SQL will be read from that. B<not implemented> This allows one to create SQL-as-programs as follows: #!/usr/bin/perl -w -MDBIx::RunSQL -e 'create()' create table ... If you want to run SQL statements from a scalar, you can simply pass in a reference to a scalar containing the SQL: sql => \"update mytable set foo='bar';", =item * C<dsn>, C<user>, C<password> - DBI parameters for connecting to the DB =item * C<dbh> - a premade database handle to be used instead of C<dsn> =item * C<force> - continue even if errors are encountered =item * C<verbose> - print each SQL statement as it is run =item * C<verbose_handler> - callback to call with each SQL statement instead of C<print> =item * C<verbose_fh> - filehandle to write to instead of C<STDOUT> =back =cut sub create { my ($self,%args) = @_; $args{sql} ||= 'sql/create.sql'; my $dbh = delete $args{ dbh }; if (! $dbh) { $dbh = DBI->connect($args{dsn}, $args{user}, $args{password}, {}) or die "Couldn't connect to DSN '$args{dsn}' : " . DBI->errstr; }; Runs an SQL file on a prepared database handle. Returns the number of errors encountered. If the statement returns rows, these are printed separated with tabs. =over 4 =item * C<dbh> - a premade database handle =item * C<sql> - name of the file containing the SQL statements =item * C<force> - continue even if errors are encountered =item * C<verbose> - print each SQL statement as it is run =item * C<verbose_handler> - callback to call with each SQL statement instead of C<print> =item * C<verbose_fh> - filehandle to write to instead of C<STDOUT> =item * C<output_bool> - whether to exit with a nonzero exit code if any row is found This makes the function return a nonzero value even if there is no error but a row was found. =item * C<output_string> - whether to output the (one) row and column, without any headers =back =cut sub run_sql_file { my ($self,%args) = @_; my @sql; { open my $fh, "<", $args{sql} or die "Couldn't read '$args{sql}' : $!"; # potentially this should become C<< $/ = ";\n"; >> # and a while loop to handle large SQL files local $/; $args{ sql }= <$fh>; # sluuurp }; $self->run_sql( %args ); } =head2 C<< DBIx::RunSQL->run_sql ARGS >> my $dbh = DBI->connect(...) for my $file (sort glob '*.sql') { DBIx::RunSQL->run_sql_file( verbose => 1, dbh => $dbh, sql => 'create table foo', ); }; Runs an SQL string on a prepared database handle. Returns the number of errors encountered. If the statement returns rows, these are printed separated with tabs, but see the C<output_bool> and C<output_string> options. =over 4 =item * C<dbh> - a premade database handle =item * C<sql> - string or array reference containing the SQL statements =item * C<force> - continue even if errors are encountered =item * C<verbose> - print each SQL statement as it is run =item * C<verbose_handler> - callback to call with each SQL statement instead of C<print> =item * C<verbose_fh> - filehandle to write to instead of C<STDOUT> =item * C<output_bool> - whether to exit with a nonzero exit code if any row is found This makes the function return a nonzero value even if there is no error but a row was found. =item * C<output_string> - whether to output the (one) row and column, without any headers =back =cut sub run_sql { my ($self,%args) = @_; my $errors = 0; ------------------------------------------------------------------------- The page runs on for another hundred lines. Would there be any method to overcome this? That seems to be a problem with the compatability with latest MySQL occuring at Bugs 16775. Thank you again for all the assistance extended! -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug. _______________________________________________ Koha-bugs mailing list Koha-bugs@lists.koha-community.org https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/