1
pr_shadoko
module update problem with mysql script : sql instructions not applied
  • 2006/4/10 9:53

  • pr_shadoko

  • Just popping in

  • Posts: 3

  • Since: 2006/4/10


Hi,

I'm trying to create my own module. Basicaly, it should work only with Xhelp and provide statistics and reports about ticketing. I'm at an early stage of developpement. I'm now trying to add a MySQL script to be runned during the installation / update of this module.
I followed the docs i've found, added lines in the xoops_version file like this :
// Sql file (must contain sql generated by phpMyAdmin or phpPgAdmin)
// All tables should not have any prefix!
$modversion['sqlfile']['mysql'] = "sql/mysql.sql";
// Tables created by sql file (without prefix!)
$modversion['tables'][0] = "xhs_lur";
$modversion['tables'][1] = "xhs_reports";

I've the mysql.sql script in the right path, with the right perms (apache:apache 755).

When I launched the update process in the "Modules/Administration" page, I clique again in the following confirmation page, everything works fine, except the MySQL instructions seems to be bypassed. and no tables are created.

I've even tried to delete the file mysql.sql, but it chenge nothing, as if the sql part of xoops_version.php were useless.
when I try to run script directly in phpmyadmin, it's ok. The tables are created so i dont think it's a MySQL syntax problem.
I guess I skipped 1 step in the procedure, but I can't get it !
Here's my conf (thanks modinfo):
XOOPS Version:
XOOPS 2.2.3 Final
XOOPS Theme:
default
XOOPS Template Set:
default
PHP Version:
5.0.4
MySQL Version:
4.1.14
Server Software:
Apache/2.0.54 (Fedora)
User's Browser:
Mozilla/5.0 (Windows; U; Windows NT 5.0; fr; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1

When I enable debug console for MySQL and php, I got nothing , no errors. The only thing I got with the debug enable are warnings about others modules ("Warning [PHP]: xoops_load_lang_file").

That's it. If anyone can enlight me, it would make me happy in this rainny day...
thx

2
pr_shadoko
Re: module update problem with mysql script : sql instructions not applied
  • 2006/4/10 11:23

  • pr_shadoko

  • Just popping in

  • Posts: 3

  • Since: 2006/4/10


Fixed :

For an unknown reason (I dont know if it's a bug or a kind of function), it seems that sql scripts are executed only during uninstall/install process, not during an update. I've uninstalled my module, it warned me that some tables couldn't be found, then reinstall and this time it created the tables.

thx.

3
Dave_L
Re: module update problem with mysql script : sql instructions not applied
  • 2006/4/10 13:36

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


You're correct in that the .sql file only gets run during install.

If you want to do custom queries when updating a module, you have to add an update script, referenced in xoops_version.php like this:

$modversion['onUpdate'] = 'include/install.inc.php';

There's more info here but it may not be up to date: http://dev.xoops.org/modules/phpwiki/index.php/DatabaseTables

For a complete example, you could look at version 1.07 of the chess module: http://dev.xoops.org/modules/xfmod/project/?chess

4
ejuden01
Re: module update problem with mysql script : sql instructions not applied
  • 2006/4/11 15:39

  • ejuden01

  • Not too shy to talk

  • Posts: 121

  • Since: 2004/4/5 1


Hello pr_shadoko,

Thanks for your interest in xHelp! Before you get too carried away, we have been working on some reporting features within xHelp. Here is a screenshot of one of the reports. This is for our next release (0.8). You might check out the latest cvs and see how it works for you. I'm interested in what reports you are looking for though. I have currently created 9 different reports. It is set up so that others can create their own reports.

Eric
A Life? Cool! Where can I download one of those from?

xhelp | sstatus

5
pr_shadoko
Re: module update problem with mysql script : sql instructions not applied
  • 2006/4/12 17:41

  • pr_shadoko

  • Just popping in

  • Posts: 3

  • Since: 2006/4/10


first of all, thx for the replies and the link for the update script. I'm very glad to read you Eric (I've seen your name so many times reading the Xhelp sources) ^^;

I dont know if this forum is the place to talk about Xhelp specific features but I must admit that i'm noob in XOOPS (tough it really deserve I spend more time on it) and not so good at programming, so my module will be quite poor (e.g : not graphical reports in the next release).
Is there a forum where we can talk about this stuff ?

I'm going to try cvs as soon as I find how to get it ^^

Thx again !

6
ejuden01
Re: module update problem with mysql script : sql instructions not applied
  • 2006/4/12 17:51

  • ejuden01

  • Not too shy to talk

  • Posts: 121

  • Since: 2004/4/5 1


Hey pr_shadoko,

We much prefer you come over to the dev.xoops.org site and discuss these things in the xHelp project page. There is a forum, you can submit features, etc.

Also, here is a direct link to the existing reporting module feature request: link

To download the latest cvs of xHelp, please go here.
A Life? Cool! Where can I download one of those from?

xhelp | sstatus

Login

Who's Online

349 user(s) are online (303 user(s) are browsing Support Forums)


Members: 0


Guests: 349


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits