Menu

#5 Table opt feature not working (suggested fix)

CVS
open-fixed
core (13)
5
2004-09-08
2003-10-17
No

We discussed this sometime ago in feature requests, and
you indicated that the following should work
<table name="applications" platform="mysql">
<opt name="type">ISAM</opt>
...
</table>

I've just had a chance to test this and it would seem
that, although the opt tag is parsed, it is ignored in
the create table sql (tested using mysqlt)

Discussion

  • Richard Tango-Lowy

    • assigned_to: nobody --> richtl
    • status: open --> open-accepted
     
  • Anonymous

    Anonymous - 2004-09-04

    Logged In: YES
    user_id=528997

    This is holding my project back as well - I need the ability
    to do innodb per-table. Using adodb's datadict I can, but
    not in an xmlschema.

    As a result, I've had to hardcode in a routine that runs an
    alter table after every table create to switch them to
    innodb - hardly portable. :)

    Fixing this would be much appreciated!

     
  • Mark Newnham

    Mark Newnham - 2004-09-05
    • summary: Table opt feature not working --> Table opt feature not working (suggested fix)
     
  • Mark Newnham

    Mark Newnham - 2004-09-05

    Logged In: YES
    user_id=822757

    I've had a look at this and identified why this is not
    working in xmlschema, and here is a suggested fix. The main
    problem is that the createTableSQL in adodb is expecting an
    associative array for tabopts, with the platform as the
    index and the option as the value, e.g [mysql]=>'type=isam'.
    xmlschema is actually sending a numeric array
    ([0]=>'type=isam'). adodb is ignoring this because the key
    of the tabopt is not the database type.

    In order to use the suggested fix, the opt element needs to
    be defined in the following way, but I think this fits in
    quite well with the general scheme of things

    <table name="some_table">
    <opt platform="mysql">TYPE=INNODB</opt>
    <opt platform="db2">IN TABLESPACE AXY</opt>
    etc etc......

    These changes are based on the current version
    adodb-xmlschema.inc.php from CVS
    ==============================================
    In class dbTable (line 192 approx)

    add var $currentOptPlatform;

    in function _tag_open (line 252 approx)

    add new case statement to switch( $this->currentElement )

    case 'OPT':
    $this->currentOptPlatform = $attributes['PLATFORM'];
    break;

    =============================================
    in function addTableOpt (line 460 approx)

    change $this->opts[] = $opt;

    to

    $this->opts[$this->currentOptPlatform] = $opt;

    ===============================================

    With this method , all opts are passed to createtablesql,
    which parses out the relevant ones
    ================================================

     
  • Anonymous

    Anonymous - 2004-09-07

    Logged In: YES
    user_id=528997

    Excellent! That would be fantastic... I look forward to the
    next release with these changes in place!

     
  • Richard Tango-Lowy

    • labels: --> core
    • milestone: --> CVS
    • status: open-accepted --> open-fixed
     
  • Richard Tango-Lowy

    Logged In: YES
    user_id=302293

    OK guys, I applied the proposed patch to CVS. Please check
    it out, test it, and let me know how it works.

    Rich

     
  • Mark Newnham

    Mark Newnham - 2005-03-25

    Logged In: YES
    user_id=822757

    I Just downloaded 1.61 from the CVS, and all this stuff
    seems to have disappeared from code.

     

Log in to post a comment.