Moodle

MetaType() function for PG (adodb) returns some incorrect values

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Won't Fix
  • Affects Version/s: 2.0
  • Fix Version/s: None
  • Component/s: Database SQL/XMLDB
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE

Description

It seems that the MetaType() function for ADOdb's postgres driver (postgres64) returns some types improperly:

1) For varchars > 100cc, it returns 'X' (clob) instead of 'C' (characters)
2) For any integer (bigint, int2, int4...) belonging to one unique key it returns 'R' (sequence, serial) instead of 'I'.

While these annoyances can be changes easily in code (both in ADOdb or in our own drivers), I've asked in ADOdb forums to know if there is any reason for that:

http://phplens.com/lens/lensforum/msgs.php?id=17963

Awaiting for some response there some days... ciao

Activity

Hide
Eloy Lafuente (stronk7) added a comment -

Nice response from John Lim arrived (pasting here):
(http://phplens.com/lens/lensforum/msgs.php?id=17963 )

===== ===== ===== =====
You're right about 2 on closer look. However when i implemented this, I needed this feature.

I will add a new property to the connection driver class:

var uniqueIisR = true;

Then after you init the driver set:

$db = ADONewConnection('postgres8');
$db->uniqueIisR = false;
$db->blobSize = $someLargeNumber;

Also change MetaType() to:

if (isset($fieldobj) && empty($fieldobj->primary_key) && empty($fieldobj->unique)) return 'I';

to

if (isset($fieldobj) && empty($fieldobj->primary_key) && (!$this->uniqueIisR || empty($fieldobj->unique))) return 'I';

This will be in next version of adodb.
===== ===== ===== =====

So I'm going to:

1) Apply that solution to current local adodb libs, documenting in readme_moodle.txt
2) Use that in our adodb PG driver
3) When new adodb is released, update, cleaning the local hack (1).

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Nice response from John Lim arrived (pasting here): (http://phplens.com/lens/lensforum/msgs.php?id=17963 ) ===== ===== ===== ===== You're right about 2 on closer look. However when i implemented this, I needed this feature. I will add a new property to the connection driver class: var uniqueIisR = true; Then after you init the driver set: $db = ADONewConnection('postgres8'); $db->uniqueIisR = false; $db->blobSize = $someLargeNumber; Also change MetaType() to: if (isset($fieldobj) && empty($fieldobj->primary_key) && empty($fieldobj->unique)) return 'I'; to if (isset($fieldobj) && empty($fieldobj->primary_key) && (!$this->uniqueIisR || empty($fieldobj->unique))) return 'I'; This will be in next version of adodb. ===== ===== ===== ===== So I'm going to: 1) Apply that solution to current local adodb libs, documenting in readme_moodle.txt 2) Use that in our adodb PG driver 3) When new adodb is released, update, cleaning the local hack (1). Ciao
Hide
Petr Škoda (skodak) added a comment -

adodb drivers not used any more except in auth and enrol that do not care about this trouble, yay!

Show
Petr Škoda (skodak) added a comment - adodb drivers not used any more except in auth and enrol that do not care about this trouble, yay!

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: