The first time I needed to have some kind of complex select statement, I started to pray about the ability to use regular expressions with mysql.
Easy as it may be: use REGEXP!
For example:
SELECT * FROM db.ip_addresses WHERE ip_address REGEXP '^192\.168\.0\.(133|135)$';
See the official documentation and details here.
Subscribe to:
Post Comments (Atom)
Wireshark setting to interpret UDP as RTP automatically
Before I forget again, a Wireshark setting that can help saving time by trying to interpret any UDP as RTP, if possible: Analyze --> Ena...
-
I needed an efficient way to programmatically extract RTP streams from a network capture. In addition I wanted to: save each stream into a s...
-
Before I forget again, a Wireshark setting that can help saving time by trying to interpret any UDP as RTP, if possible: Analyze --> Ena...
-
Docker is an incredibly useful tool to build prototypes of Linux hosts and applications. You can easily build a network of servers inside...
hey! nice blog :) I've quit my weblogging activity, but I'm posting a lot on flickr :)
ReplyDeleteAnyway, I think regexp is quite slow, perhaps ... where ip_address ='192.168.0.133' or ip_address='192.168.0.135'
is quicker if ip_address is indexed. Obviously, more complex regexp cannot be converted easily...
Thanks for your comment.
ReplyDeletePerformance has been my first concern, although I haven't found so far a clear documentation on possible impacts.
Given that yes, it's probably not worth using a regexp for just 2 IP addresses, in my case the mysql statement is 'generated' by some other code and configuration files, so using that approach gives me the impression of higher flexibility.
Cheers