]> git.koha-community.org Git - koha.git/commit
Bug 13669: Use perl to load SQL statements from sample data
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 18 May 2016 16:23:25 +0000 (13:23 -0300)
committerJulian Maurice <julian.maurice@biblibre.com>
Wed, 25 May 2016 06:52:42 +0000 (08:52 +0200)
commit7c7109c4569de1f2afb2cec4013c40b242d8c730
tree8cf11d4d3dd3feec58c60f2f89e444942a3fd66b
parent2293f85092714133d47bf846069d48c81e23e4f5
Bug 13669: Use perl to load SQL statements from sample data

This patch changes C4::Installer::load_sql so it uses File::Slurp [1] to read
the SQL files, and SQL::SplitStatement to extract the statements from the full SQL
file so they can be passed to $dbh->do.

To test:
- On Mysql 5.5, run the webinstaller
=> SUCCESS: Everything works as expected
- Apply the patch
- Run
  $ mysql -uroot
  > DROP DATABASE koha_kohadev ; CREATE DATABASE koha_kohadev;
- Run the webinstaller
=> SUCCESS: Everything works as expected
- On Mysql 5.6+ (5.7 is implied)
- Run
  $ mysql -uroot
  > DROP DATABASE koha_kohadev ; CREATE DATABASE koha_kohadev;
- Run the webinstaller
=> FAIL: It cannot load the sql files due to a password-in-command-line error
- Apply the patch
- Make sure everything is clean (it should):
  $ mysql -uroot
  > DROP DATABASE koha_kohadev ; CREATE DATABASE koha_kohadev;
- Run the webinstaller
=> SUCCESS: EVerything works as expected
- Sign off :-D

[1] Note: This is a POC patch, in the sense that it does the job, fixes a nasty problem
but using File::Slurp to load the SQL files in memory comes with a big runtime penalty.
You will notice the install procedure is now much slower, for instance.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 5c151f35aac55c3b4c92fb11397d4ef3b8c9f9b8)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
C4/Installer.pm