[Koha-patches] [PATCH] [3.2] Bug 4141 Reconcile 3.0.x and HEAD database updates for 3.2.0

Colin Campbell colin.campbell at ptfs-europe.com
Wed May 12 14:31:55 CEST 2010


On 12/05/10 13:00, Chris Nighswonger wrote:
> This is a partial fix addressing this error:
>
> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 at /home/koha/koha.prod/installer/data/mysql/updatedatabase.pl line 2916., referer: http://koha-staff.foobar.org/cgi-bin/koha/installer/install.pl
>
> If there are no records in aqbudgets the result is an empty array which causes the sql to attempt to set AUTOINCREMENT to null.
>
> This patch is being submitted on behalf of the Mapua Community Library.
> ---
>   installer/data/mysql/updatedatabase.pl |    2 ++
>   1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
> index 89b8c0f..53fec36 100755
> --- a/installer/data/mysql/updatedatabase.pl
> +++ b/installer/data/mysql/updatedatabase.pl
> @@ -2913,6 +2913,8 @@ BUDGETNAME
>   SELECT MAX(aqbudgetid) from aqbudgets
>   IDsBUDGET
>
> +$$maxbudgetid[0] = 0 if !$$maxbudgetid[0];
> +
>       $dbh->do(<<BUDGETAUTOINCREMENT);
>   ALTER TABLE `aqbudgets` AUTO_INCREMENT=$$maxbudgetid[0]
>   BUDGETAUTOINCREMENT

Quick thought - is it not safer to use NULL rather than 0 as the 
behaviour of auto_increment passed 0 is dependent on the SQL mode that 
MySQL is running under? (sorry scarred by an early experience of 
restoring a db to find all our auto_incremented row ids had changed!!)
Colin

-- 
Colin Campbell
Chief Software Engineer,
PTFS Europe Limited
Content Management and Library Solutions
+44 (0) 208 366 1295 (phone)
+44 (0) 7759 633626  (mobile)
colin.campbell at ptfs-europe.com
skype: colin_campbell2

http://www.ptfs-europe.com



More information about the Koha-patches mailing list