https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22159
--- Comment #1 from Tomás Cohen Arazi <[email protected]> --- Created attachment 84174 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=84174&action=edit Bug 22159: Add ColumnExists method This patch adds a method for checking if a column exists on a DB table. The way this is checked is used already on updatedatabase.pl [1] (i.e. querying INFORMATION_SCHEMA. To test: - Create an atomicupdate file like this: $ cd installer/data/mysql/atomicupdate $ cp skeleton.perl test.perl - Change the contents of test.perl so it looks like this: $DBversion = 'XXX'; if( CheckVersion( $DBversion ) ) { if ( ColumnExists( 'borrowers', 'firstname' ) ) { print "Column borrowers.firstname exists!"; } else { print "Boo, borrowers.firstname wasn't detected"; } if ( ColumnExists( 'borrowers', 'friendly_alias' ) ) { print "Great, there's no borrowers.firend_alias"; } else { print "Boo, this is really wrong"; } } - Run: $ updatedatabase or $ kshell k$ perl installer/data/mysql/updatedatabase.pl => SUCCESS: No 'Boo' message is printed - Sign off :-D [1] See 3.03.00.023 or 18.12.00.002 -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] http://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/
