[Digikam-devel] [Bug 288599] Schema update to V6 failed

Francesco Riosa francesco+kde at pnpitalia.it
Fri Dec 9 22:36:49 GMT 2011


https://bugs.kde.org/show_bug.cgi?id=288599





--- Comment #3 from Francesco Riosa <francesco+kde pnpitalia it>  2011-12-09 22:36:49 ---
the (mysql digikam code) problem is that you're using two different databases
for images and thumbnails.

try to execute the following SQL in both databases, and then restart digikam:

DROP PROCEDURE IF EXISTS create_index_if_not_exists;

delimiter ;;

CREATE PROCEDURE create_index_if_not_exists(table_name_vc varchar(50),
index_name_vc varchar(50), field_list_vc varchar(1024), is_unique int)
SQL SECURITY INVOKER
BEGIN

set @Index_cnt = (
    SELECT COUNT(1) cnt
    FROM INFORMATION_SCHEMA.STATISTICS
    WHERE CONVERT(DATABASE() USING latin1) = CONVERT(TABLE_SCHEMA USING latin1)
    AND CONVERT(table_name USING latin1) = CONVERT(table_name_vc USING latin1)
    AND CONVERT(index_name USING latin1) = CONVERT(index_name_vc USING latin1)
);

IF IFNULL(@Index_cnt, 0) = 0 THEN
    set @index_sql = CONCAT(
        CONVERT( 'ALTER TABLE ' USING latin1),
        CONVERT( table_name_vc USING latin1),
        CONVERT( IF(is_unique = 0, ' ADD INDEX ', ' ADD UNIQUE INDEX ') USING
latin1),
        CONVERT( index_name_vc USING latin1),
        CONVERT( '(' USING latin1),
        CONVERT( field_list_vc USING latin1),
        CONVERT( ');' USING latin1)
    );
    PREPARE stmt FROM @index_sql;
    EXECUTE stmt;
    DEALLOCATE PREPARE stmt;
END IF;
END ;;

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Digikam-devel mailing list