1

I have a module which has some DB Functions during installation for which i have made the reference
install.mysql.utf8.sql
uninstall.mysql.utf8.sql

in the mod_score.xml (mod_score is the name of the module)
mode_score.xml It shows
" installing module was successful " but checking the database there are no tables installed . please let me know how to solve I have searched here but didnt work

<files>
    <filename>mod_score.xml</filename>
    <filename module="mod_score">mod_score.php</filename>
    <filename>helper.php</filename>
    <filename>index.html</filename>
        <folder>tmpl</folder>
        <folder>sql</folder>
        <folder>sql/mysql</folder>
        <filename>tmpl/default.php</filename>
        <filename>tmpl/index.html</filename>
        <filename>tmpl/form_success.php</filename> 
        <filename>sql/mysql/install.mysql.utf8.sql</filename>
        <filename>sql/mysql/uninstall.mysql.utf8.sql</filename>
</files>
<install>
        <sql>
         <file driver="mysql" charset="utf8">sql/mysql/install.mysql.utf8.sql</file>
        </sql>
</install>
<uninstall> <!-- Runs on uninstall -->
    <sql>
        <file driver="mysql" charset="utf8">sql/mysql/uninstall.mysql.utf8.sql</file>
    </sql>
</uninstall>

install.mysql.utf8.sql

  DELIMITER $$

-- Match Records 
CREATE TABLE IF NOT EXISTS  `#__match_record` (
 `match_id` int(10) NOT NULL AUTO_INCREMENT,
     ---
     ---
 `match_comments` text NOT NULL,
 PRIMARY KEY (`match_id`)
) ENGINE=InnoDB AUTO_INCREMENT=122 DEFAULT CHARSET=utf8
-- Batting Records

CREATE TABLE IF NOT EXISTS  `#__batting_record` (
 `id` int(15) NOT NULL AUTO_INCREMENT,
 `pname` varchar(40) DEFAULT 'DNP',
 ---
 ---
 `timeinserted` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=244 DEFAULT CHARSET=utf8

-- Bowling Records
CREATE TABLE IF NOT EXISTS  `#__bowling_record` (
 `id` int(10) NOT NULL AUTO_INCREMENT,
 `no` int(10) NOT NULL,
 ---
 ---


 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=49 DEFAULT CHARSET=utf8


END $$
DELIMITER ;

Version - Joomla 3.+

1

You don't have to specify subfolders and files in folders what you already have specified. Just use <folder>tmpl</folder> and <folder>sql</folder>.

No need for <folder>sql/mysql</folder> etc. Whole folder is already being installed.

Your <files> tag would be.

<files>
    <filename>mod_score.xml</filename>
    <filename module="mod_score">mod_score.php</filename>
    <filename>helper.php</filename>
    <filename>index.html</filename>
    <folder>tmpl</folder>
    <folder>sql</folder>
</files>

Now, your problem. Remove DELIMITER $$ and END $$ DELIMITER ;.

See this answer for clarification. There has to be ; in end of every mysql query if you have multiple queries in one file.

Your sql should look like this:

-- Match Records 
CREATE TABLE IF NOT EXISTS  `tst_match_record` (
 `match_id` int(10) NOT NULL AUTO_INCREMENT,
 `match_comments` text NOT NULL,
 PRIMARY KEY (`match_id`)
) ENGINE=InnoDB AUTO_INCREMENT=122 DEFAULT CHARSET=utf8;
-- Batting Records

CREATE TABLE IF NOT EXISTS  `tst_batting_record` (
 `id` int(15) NOT NULL AUTO_INCREMENT,
 `pname` varchar(40) DEFAULT 'DNP',
 `timeinserted` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=244 DEFAULT CHARSET=utf8;

-- Bowling Records
CREATE TABLE IF NOT EXISTS  `tst_bowling_record` (
 `id` int(10) NOT NULL AUTO_INCREMENT,
 `no` int(10) NOT NULL,
 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=49 DEFAULT CHARSET=utf8;
  • those --- in the create table was just to avoid writing all the excessive columns in the code ! And your solution worked right ! – Srinath Naidu May 22 '15 at 6:13
  • Okay. Sorry, now I understand. – Rene Korss May 22 '15 at 6:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.