Hi,

I have figured out the problems on the IPv4 on the where clause. Actually, IPv4 
address store and retrieve work perfectly on the IPv6 Data on Xcode . The only 
problem is on the table display length, because current display length is 39 
which is fit for IPv6 address but the IPv4 address length is 15. 

I am not sure whether both IPv4 and IPv6 works together or not due the problem 
of extra character found.

John, I am facing trouble on setting the drizzle on my mac, could you please 
make come changes as mention below and try to compile again.

In type/ipv6.h file

Add these variables on the end

    static const size_t IPV4_DISPLAY_LENGTH= 4;;
    static const size_t IPV4_BUFFER_LENGTH= IPV4_DISPLAY_LENGTH+1;

on the function ipv4_inet_ntop(char *destination)

replace this 

        snprintf(destination, IPV4_BUFFER_LENGTH, "d.d.d.d" ,

In field/ipv6.cc file


on the function String *IPv6::val_str(String *val_buffer, String *) const

replace these lines.

      uint32_t mlength= (type::IPv6::IPV4_BUFFER_LENGTH)  * cs->mbmaxlen;  

      val_buffer->alloc(mlength);


Also, any one in drizzle team, who knows about these functions
   
val_str()
max_string_length()
max_display_length()

Please let me the roles of these functions.

Besides, I am trying to compile drizzle again and fix this issue today. 

John let me know your IRC id.

Regards,

Umair Muhammad
Electrical Engineering Master Student,
Specialization in Wireless Systems,
School of Electrical Engineering,
Royal Institute of Technology (KTH),
SE 100-44 Stockholm, SWEDEN.
Email: [email protected]
Cell:   +46 764 097 574
________________________________________
From: John Z. [[email protected]]
Sent: Thursday, March 22, 2012 7:03 PM
To: Muhammad Umair
Subject: Re: [Drizzle-discuss] IPv4 selection from IPv6 column

That would be awesome! Can you please tell me how did you manage to
select from the data type? I copypasted the query I used in the topic,
but it keeps failing for me :-(


> Dear John,
>
> Actually, I haven't idea why table entry contain extra character. Retrieving 
> form the date type works well and only problem is on the table display. I am 
> trying on my machine, if works I will update you soon.
>
> Regards.
>
> Umair Muhammad
> Electrical Engineering Master Student,
> Specialization in Wireless Systems,
> School of Electrical Engineering,
> Royal Institute of Technology (KTH),
> SE 100-44 Stockholm, SWEDEN.
> Email: [email protected]
> Cell:   +46 764 097 574
> ________________________________________
> From: [email protected] 
> [[email protected]] on behalf of John 
> Z. [[email protected]]
> Sent: Thursday, March 22, 2012 3:48 PM
> To: [email protected]
> Subject: Re: [Drizzle-discuss] IPv4 selection from IPv6 column
>
> Hey Muhammad,
>       judging by variable name, this is only to fix display. The issue is
> that I still can't select by IPv4 value. I may be wrong at assuming that
> DISPLAY_LENGTH const is used only to trim display... please confirm.
>
>       Cheers.
>
>> Dear John,
>>
>> I think you haven't figure out the problem. Anyways, no problem.
>>
>> Could you make the following below changes
>>
>> Go to drizzled/type/ipv6.h
>>
>> You need to change the value of static const size_t IPV6_DISPLAY_LENGTH= 39;
>>
>> with
>>
>> static const size_t IPV6_DISPLAY_LENGTH= 15;
>>
>> I think this will work with IPv4 and gives problem with IPv6. Anyways, you 
>> try it and let me know, if it solved your problem, otherwise, I can spend a 
>> day to fix it as soon.
>>
>> Feel free to comment it .
>>
>> Regards,
>>
>> Umair Muhammad
>> Electrical Engineering Master Student,
>> Specialization in Wireless Systems,
>> School of Electrical Engineering,
>> Royal Institute of Technology (KTH),
>> SE 100-44 Stockholm, SWEDEN.
>> Email: [email protected]
>> Cell:   +46 764 097 574
>> ________________________________________
>> From: [email protected] 
>> [[email protected]] on behalf of 
>> John Z. [[email protected]]
>> Sent: Monday, March 19, 2012 8:35 PM
>> To: [email protected]
>> Subject: Re: [Drizzle-discuss] IPv4 selection from IPv6 column
>>
>> Hi again,
>> after building and testing with change suggested by Mr. Umair, the code
>> isn't working still. Presentation changed, though, now the IPv4 is
>> presented as IPv4, but with some extra unknown chars.
>>
>>
>>
>> drizzle>   delete from cassandra_cluster;
>> Query OK, 1 row affected (0.114925 sec)
>>
>> drizzle>   insert into cassandra_cluster values('10.128.4.10', 9160);
>> Query OK, 1 row affected (0.100776 sec)
>>
>> drizzle>   select * from cassandra_cluster;
>> +-----------------------------------------+------+
>> | node | port |
>> +-----------------------------------------+------+
>> | 10.128.4.10 �� �� | 9160 |
>> +-----------------------------------------+------+
>> 1 row in set (0.00049 sec)
>>
>> drizzle>   select * from cassandra_cluster where node='10.28.4.10';
>> Empty set (0.000378 sec)
>>
>>
>> If anybody has any idea, they're welcome.
>>
>> Cheers.
>>
>>
>>> Dear John,
>>>
>>> I saw your emails for pointing out the bug. If you are working to fix it.
>>>
>>> I figured out the problem.
>>>
>>> I hope problem will be solved if you replace the following code of the 
>>> function
>>>
>>>     char * ipv4_inet_ntop(char *destination)
>>> {
>>>
>>>      memset(destination,NULL,sizeof(destination));
>>>
>>>               snprintf( destination ,IPV6_BUFFER_LENGTH, 
>>> "%03x:%03x:%03x:%03x:%03x:%03x:%03d.%03d.%03d.%03d" ,
>>>                 
>>> str.ip6[0],str.ip6[1],str.ip6[2],str.ip6[3],str.ip6[4],str.ip6[5],
>>>                (((unsigned int )str.ip6[6]>>8)&    0xFF),
>>>                 ((unsigned int )str.ip6[6]&    0xFF),
>>>                 (((unsigned int )str.ip6[7]>>8)&    0xFF),
>>>                 ((unsigned int )str.ip6[7]&    0xFF));
>>>
>>>                return destination;
>>>         }// end of ipv4_inet_ntop function
>>>
>>> The new function code,
>>>
>>>     char * ipv4_inet_ntop(char *destination)
>>> {
>>>
>>>      memset(destination,NULL,sizeof(destination));
>>>
>>>               snprintf( destination ,IPV6_BUFFER_LENGTH, "%d.%d.%d.%d" ,
>>>
>>>                (((unsigned int )str.ip6[6]>>8)&    0xFF),
>>>                 ((unsigned int )str.ip6[6]&    0xFF),
>>>                 (((unsigned int )str.ip6[7]>>8)&    0xFF),
>>>                 ((unsigned int )str.ip6[7]&    0xFF));
>>>
>>>                return destination;
>>>         }// end of ipv4_inet_ntop function
>>>
>>>
>>> I haven't run it, but I think it will be fixed. The problem is only this 
>>> function. Rest of the code base is work well. If you need more help. Feel 
>>> free to ask me.
>>>
>>>
>>> Regards,
>>>
>>> Umair Muhammad
>>> Electrical Engineering Master Student,
>>> Specialization in Wireless Systems,
>>> School of Electrical Engineering,
>>> Royal Institute of Technology (KTH),
>>> SE 100-44 Stockholm, SWEDEN.
>>> Email: [email protected]
>>> Cell:   +46 764 097 574
>>> ________________________________________
>>> From: [email protected] 
>>> [[email protected]] on behalf of 
>>> John Z. [[email protected]]
>>> Sent: Thursday, March 15, 2012 9:46 PM
>>> To: [email protected]
>>> Subject: Re: [Drizzle-discuss] IPv4 selection from IPv6 column
>>>
>>>> You mean by diving into the code yourself? That would certainly be
>>>> most welcome. The IPV6 data type was done by a Google Summer of Code
>>>> student. So while he is still engaged with the project, it is of
>>>> course on-off depending on his studies and other priorities.
>>> Yup, that's what I meant :-) Best way to get stuff fixed is to fix it
>>> yourself, right?
>>>
>>>> The type is defined and implemented in
>>>>
>>>> drizzled/type/ipv6.h
>>>> drizzled/field/ipv6.cc
>>>>
>>>> If you "grep -Ri ipv6" you will find more places that are involved.
>>>> I'm happy to guide you around more if needed. (But I'm not personally
>>>> familiar with this code, so I can't point you to the exact line where
>>>> the bug is.)
>>> That would be most welcome! I'm branching off bazaar right now, I'll
>>> dwell into the code as soon as its done. I'll post here with questions,
>>> if I have nay.
>>> Cheers.
>>>
>>>> henrik
>>>>
>>>> On Thu, Mar 15, 2012 at 10:27 PM, John Z.<[email protected]>     
>>>> wrote:
>>>>> Sure thing, on it now. Thanks.
>>>>>
>>>>> Btw, since I don't know how long will the wait last until bug gets to be
>>>>> fixed - can I help fixing it, somehow? My employer most probably won't 
>>>>> mind
>>>>> since we need this functionality.
>>>>>
>>>>>
>>>>> John
>>>>>
>>>>>> Yep
>>>>>>
>>>>>> drizzle>       describe ipaddress_table;
>>>>>> +-------+------+------+---------+-----------------+-----------+
>>>>>> | Field | Type | Null | Default | Default_is_NULL | On_Update |
>>>>>> +-------+------+------+---------+-----------------+-----------+
>>>>>> | addr  | IPV6 | YES  |         | YES             |           |
>>>>>> +-------+------+------+---------+-----------------+-----------+
>>>>>> 1 row in set (0.001061 sec)
>>>>>>
>>>>>> drizzle>       insert into ipaddress_table values ('10.28.4.10');
>>>>>> Query OK, 1 row affected (0.009366 sec)
>>>>>>
>>>>>> drizzle>       select * from ipaddress_table;
>>>>>> +-----------------------------------------+
>>>>>> | addr                                    |
>>>>>> +-----------------------------------------+
>>>>>> | 000:000:000:000:000:000:010.028.004.010 |
>>>>>> +-----------------------------------------+
>>>>>> 1 row in set (0.000795 sec)
>>>>>>
>>>>>> drizzle>       select * from ipaddress_table where addr='10.28.4.10';
>>>>>> Empty set (0.000814 sec)
>>>>>>
>>>>>>
>>>>>> Please file a bug. Any value that will be accepted for insert, should
>>>>>> certainly be accepted for where clause too.
>>>>>>
>>>>>> henrik
>>>>>>
>>>>>>
>>>>>> On Thu, Mar 15, 2012 at 9:35 PM, John Z.<[email protected]>
>>>>>>      wrote:
>>>>>>> Hello,
>>>>>>>        I have a table with IPv6 column. Documentation says IPv6 
>>>>>>> supports IPv4
>>>>>>> values too, so I'm using same column to store both values if needed.
>>>>>>>        IPv6 insertion/selection works just fine, however I can't figure 
>>>>>>> out
>>>>>>> proper string format when trying to select by an IPv4 value - it always
>>>>>>> returns an empty result set.
>>>>>>>
>>>>>>>        Describe table and some examples follow:
>>>>>>>
>>>>>>>
>>>>>>> drizzle>       describe cassandra_cluster;
>>>>>>> +-------+---------+------+---------+-----------------+-----------+
>>>>>>> | Field | Type    | Null | Default | Default_is_NULL | On_Update |
>>>>>>> +-------+---------+------+---------+-----------------+-----------+
>>>>>>> | node  | IPV6    | NO   |         | NO              |           |
>>>>>>> | port  | INTEGER | NO   |         | NO              |           |
>>>>>>> +-------+---------+------+---------+-----------------+-----------+
>>>>>>>
>>>>>>> drizzle>       insert into cassandra_cluster values('::10.28.4.10', 
>>>>>>> 9160);
>>>>>>> Query OK, 1 row affected (0.100422 sec)
>>>>>>>
>>>>>>> drizzle>       select * from cassandra_cluster;
>>>>>>> +-----------------------------------------+------+
>>>>>>> | node                                    | port |
>>>>>>> +-----------------------------------------+------+
>>>>>>> | 000:000:000:000:000:000:010.028.004.010 | 9160 |
>>>>>>> +-----------------------------------------+------+
>>>>>>> 1 row in set (0.00042 sec)
>>>>>>>
>>>>>>> drizzle>       select * from cassandra_cluster where 
>>>>>>> node='::10.28.4.10';
>>>>>>> Empty set (0.000433 sec)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Here, I tried various formats for '::10.28.4.10', but all of them
>>>>>>> failing,
>>>>>>> together with copy-paste of output from select *.
>>>>>>> I tried on IRC, but we concluded that it could be a bug, and I was
>>>>>>> suggested
>>>>>>> to try here first, before reporting it.
>>>>>>>
>>>>>>> Please, help :-)
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Mailing list: https://launchpad.net/~drizzle-discuss
>>>>>>> Post to     : [email protected]
>>>>>>> Unsubscribe : https://launchpad.net/~drizzle-discuss
>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>
>>>>> _______________________________________________
>>>>> Mailing list: https://launchpad.net/~drizzle-discuss
>>>>> Post to     : [email protected]
>>>>> Unsubscribe : https://launchpad.net/~drizzle-discuss
>>>>> More help   : https://help.launchpad.net/ListHelp
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~drizzle-discuss
>>> Post to     : [email protected]
>>> Unsubscribe : https://launchpad.net/~drizzle-discuss
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~drizzle-discuss
>> Post to     : [email protected]
>> Unsubscribe : https://launchpad.net/~drizzle-discuss
>> More help   : https://help.launchpad.net/ListHelp
>
> --
> If you are reading this then this warning is for you. Every word you read of 
> this useless fine print is another second off your life. Don't you have other 
> things to do? Is your life so empty that you honestly can't think of a better 
> way to spend these moments? Do you read everything you're supposed to read? 
> Do you think everything you're supposed to think? Buy what you're told you 
> should want?
> Get out of your office. Meet a member of the opposite sex. Stop the excessive 
> shopping and masturbation. Quit your job. Start a fight. Prove you're alive. 
> If you don't claim your humanity you will become a statistic.
> You have been warned......
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~drizzle-discuss
> Post to     : [email protected]
> Unsubscribe : https://launchpad.net/~drizzle-discuss
> More help   : https://help.launchpad.net/ListHelp


--
If you are reading this then this warning is for you. Every word you read of 
this useless fine print is another second off your life. Don't you have other 
things to do? Is your life so empty that you honestly can't think of a better 
way to spend these moments? Do you read everything you're supposed to read? Do 
you think everything you're supposed to think? Buy what you're told you should 
want?
Get out of your office. Meet a member of the opposite sex. Stop the excessive 
shopping and masturbation. Quit your job. Start a fight. Prove you're alive. If 
you don't claim your humanity you will become a statistic.
You have been warned......

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to