Menu

#6 MySQL TINYTEXT bug in ExtractSchema

open
nobody
None
5
2008-04-01
2008-04-01
No

I've found when extracting a schema from a MySQL database, tables with TINYTEXT fields do not have a size specified in the xml. This causes the xml generated when parsing the schema to be invalid.

I've fixed this by adding in the size for a type "C" field where no size has been found and defaulting this to 255 chars (the size of TINYTEXT):

===================================================================
--- adodb/adodb-xmlschema03.inc.php
+++ adodb/adodb-xmlschema03.inc.php
@@ -2145,6 +2145,10 @@
$details->primary_key = 0;
$type = $rs->MetaType( $details );

+ if ($type == 'C' && (!isset($details->max_length) || $details->max_length <= 0)) {
+ $extra .= ' size="255"';
+ }
+
$schema .= str_repeat( $indent, 2 ) . '<field name="' . htmlentities( $details->name ) . '" type="' . $type . '"' . $extra;

if( !empty( $content ) ) {
@@ -2400,4 +2404,4 @@
echo '</pre>';
}
}
-?>
\ No newline at end of file
+?>

Sorry if this has already been fixed, I'm not 100% sure I have the latest adodb version.

Discussion

  • Dave Gudgeon

    Dave Gudgeon - 2008-04-01

    fix

     
  • Dave Gudgeon

    Dave Gudgeon - 2008-04-01

    Logged In: YES
    user_id=2051610
    Originator: YES

    "This causes the xml generated when parsing the schema to be invalid."

    should read:

    This causes the sql generated when parsing the schema to be invalid.

     

Log in to post a comment.