CAROB don't recover Metadata field information correctly (FIELD FLAGS)
----------------------------------------------------------------------

         Key: CAROB-126
         URL: https://forge.continuent.org/jira/browse/CAROB-126
     Project: Carob
        Type: Bug
    Versions: Carob 0.7.2, Carob 0.7.1, Carob 0.7, Carob 0.6.2, Carob 0.6, 
Carob 0.5    
 Environment: PHP 5.2, Mysql 5.0.22, Carob 0.7.2, Sequoia 2.10.5
    Reporter: r
 Assigned to: Gilles Rayrat 


If you try to recover Field Flags, using for example the function 
mysqli_fetch_field and try to get the propery object flags, Sequoia doesn't 
return you correct values. This avoid to determinet if a certain field is a 
primary key, unique, indexed, not null... correctly. I'm not absolutely sure if 
this bug is from Sequoia or from Carob, so I opened also a ticket in Sequoia to 
study it.
I tried to attack with the same code one table to get Fields informatión, with 
sequoia and without it....  This is the table and the code and these the 
results, to easy test of the bug:

        Field name      Type    Allow nulls?    Key     Default value   Extras
        id      int(20)   unsigned         No       Primary     auto_increment
        gateway       varchar(50)       No      Indexed        
        domain         varchar(50)       No     None   
        subscriber    varchar(50)       No      None   
        dest_id          varchar(25)      No    Indexed        
        dest_name   varchar(255)    No      None       

TEST CODE:
<?php

$mysqli = new mysqli("DB1 DB2", "user", "pass", "VBD");

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

$query = "select * from destinations limit 1";

if ($result = $mysqli->query($query)) {

    /* Get field information for all columns */
    while ($finfo = $result->fetch_field()) {

        printf("Name:     %s\n", $finfo->name);
        printf("Type:     %d\n\n", $finfo->type);
        printf("Len: %d\n", $finfo->max_length);
        printf("Table:    %s\n", $finfo->table);
        printf("Flags:    %d\n", $finfo->flags);
     }
?>
       
WITH CAROB:

Name: id
Tipo: int
Len: 20
Flags: not_null unsigned auto_increment
Flags Original Number: 37409

Name: gateway
Tipo: string
Len: 50
Flags: not_null unsigned
Flags Original Number: 4129

Name: domain
Tipo: string
Len: 50
Flags: not_null unsigned
Flags Original Number: 4129

Name: subscriber
Tipo: string
Len: 50
Flags: not_null unsigned
Flags Original Number: 4129

Name: dest_id
Tipo: string
Len: 25
Flags: not_null unsigned
Flags Original Number: 4129

WITHOUT CAROB (SAME CODE):
Name: id
Tipo: int
Len: 20
Flags: not_null primary_key unsigned auto_increment
Flags Original Number: 49699

Tabla: destinations
Name: gateway
Tipo: string
Len: 50
Flags: not_null multiple_key
Flags Original Number: 16393

Name: domain
Tipo: string
Len: 50
Flags: not_null
Flags Original Number: 16385

Name: subscriber
Tipo: string
Len: 50
Flags: not_null
Flags Original Number: 16385

Name: dest_id
Tipo: string
Len: 25
Flags: not_null multiple_key
Flags Original Number: 16393

Name: dest_name
Tipo: string
Len: 255
Flags: not_null
Flags Original Number: 1

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   https://forge.continuent.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


_______________________________________________
Carob mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob

Reply via email to