1

Topic: Mod Install Scripts

If an install script creates a table and/or alters an existing table do you have to do anything special to support postgre. I figured that since PunBB supports both mysql and postge then maybe mod installs should do the same.

Re: Mod Install Scripts

Ehh.. if I'm not more sick than i thought, it's already doing that.. at least that one in MOD_SDK.zip

3

Re: Mod Install Scripts

I have been looking at PunBB's install.php and noticed that it is using a switch to run different queries to create tables in postgre and mysql. What I was asking is do I have to do that in a mod install script. I don't know anything about postgre so I have been assuming that a query that creates a mysql table will also create a postgre table without any problems.

Re: Mod Install Scripts

Well, some queries work fine in both mysql and postgresql. If you show me the query I can tell you if it will work in postgres.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

5 (edited by ps21 2003-10-04 22:43)

Re: Mod Install Scripts

Kennel wrote:

Well, some queries work fine in both mysql and postgresql. If you show me the query I can tell you if it will work in postgres.

Here it is

$query = CREATE TABLE '$db->prefix.'ranks_g (
                  rg_on tinyint(1) NOT NULL default '1',
                  rg_adv tinyint(1) NOT NULL default '0',
                  rank_pip varchar(100) NOT NULL default 'img/rankb.gif',
                  rank_gpip varchar(100) NOT NULL default 'img/rankd.gif',
                  admin_pic varchar(100) NOT NULL default '',
                  mod_pic varchar(100) NOT NULL default '',
                  show_amtitle tinyint(1) NOT NULL default '1',
                  show_ampic tinyint(1) NOT NULL default '0',
                  show_amexpips tinyint(1) NOT NULL default '1',
                  ) TYPE=MyISAM;';

It's the last line which leads me to believe this is mysql specific.

Re: Mod Install Scripts

Remove "TYPE=MyISAM" and change "tinyint(1)" to just "smallint" (pgsql doesn't have the tinyint type) and it should work fine with PostgreSQL.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

7

Re: Mod Install Scripts

Thanks, will do.

I hope chacmool is reading this as his Poll Mod has a similar query in it.