Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inet data types decoding #61

Open
guice opened this issue Feb 20, 2014 · 2 comments
Open

Inet data types decoding #61

guice opened this issue Feb 20, 2014 · 2 comments

Comments

@guice
Copy link

guice commented Feb 20, 2014

Now that I have selecting working, I found inet column types aren't being decoded:

 sid  | visit_dt                 | aid | browser | cid  | ip              | referrer | terms
------+--------------------------+-----+---------+------+-----------------+----------+-------
 7479 | 2010-04-01 10:31:53-0700 |  -1 |         | 4983 | 117.195.200.117 |          |

Return data:

{ 
  sid: '7479',
  visit_dt: Thu Apr 01 2010 10:31:53 GMT-0700 (PDT),
  aid: -1,
  browser: '',
  cid: '4983',
  ip: <Buffer 75 c3 c8 75>, // <-- Here
  referrer: '',
  terms: '' }

However, accessing each octet individually works:

[r.ip[0], r.ip[1], r.ip[2],r.ip[3]].join('.');

// returns: 117.195.200.117
@jorgebay
Copy link
Owner

It's intentional, I think an unsigned array of integers (bytes) is the most effective way to represent an IPv4 and IPv6 address.

If you would like, I could change the name of the issue and open it for discussion to see what other people think...

@guice
Copy link
Author

guice commented Feb 20, 2014

Sure. I think a large part of the issue is more a compatibility thing. Everything takes an IP as a string when handling. Having this come back as an array of the hex/octet values is a little "raw" per-say. People would expect to see the IP, as they do when you run a select via cqlsh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants