DPL:Manual - DPL with PostgreSQL

From FollowTheScore
Revision as of 23:13, 19 July 2007 by Gero (talk | contribs) (New page: {{Type:Manual |section= PostgreSQL }} == Database Functions == The code of this extenstion uses some MySQL-specific functions which don't exist in PostgreSQL. In order to avoid patching...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Template:Type:Manual

Database Functions

The code of this extenstion uses some MySQL-specific functions which don't exist in PostgreSQL. In order to avoid patching each new version of DyanmicPageList, I suggest to run the following script on your postgres Database (from the postgres account). This simply emulates the MySQL functions.

create schema mysql;

grant usage on schema mysql to public;

alter user wikiuser set search_path to mediawiki, public, mysql;

create or replace function mysql.concat(text, text) returns text
as $function$
  begin
    return $1 || $2;
  end;
$function$ language plpgsql immutable strict;

create or replace function mysql.if(boolean, text, text) returns text
as $function$
  begin
    if $1 then
      return $2;
    else
      return $3;
    end if;
  end;
$function$ language plpgsql immutable strict;

DPL Patch

Note: The following problem was resolved with DPL 1.2.0

A more unpleasant problem is that DPL 1.1.7 uses double quotes to quote literal strings (e.g. for the parameter titlematch). The only solution is to modify the code. The patch is as follows:

1784c1784
<         $sSqlWhere .= ' AND page_title = "' . $sTitleIs . '"';
---
>         $sSqlWhere .= ' AND page_title = \'' . $sTitleIs . '\'';
1794c1794
<     	    	$sSqlWhere .= 'pl_title' . $sTitleMatchMode . '"' . $link .'"';
---
>     	    	$sSqlWhere .= 'pl_title' . $sTitleMatchMode . '\'' . $link .'\'';
1796c1796
<     	    	$sSqlWhere .= 'page_title' . $sTitleMatchMode . '"' . $link .'"';
---
>     	    	$sSqlWhere .= 'page_title' . $sTitleMatchMode . '\'' . $link .'\'';
1809c1809
< 	        	$sSqlWhere .= 'pl_title' . $sNotTitleMatchMode . '"' . $link .'"';
---
> 	        	$sSqlWhere .= 'pl_title' . $sNotTitleMatchMode . '\'' . $link .'\'';
1811c1811
< 	        	$sSqlWhere .= 'page_title' . $sNotTitleMatchMode . '"' . $link .'"';
---
> 	        	$sSqlWhere .= 'page_title' . $sNotTitleMatchMode . '\'' . $link .'\'';