Dominique Devienne, on Thursday, May 23, 2019 07:02 AM, wrote... >On Thu, May 23, 2019 at 12:37 PM Simon Slavin <slav...@bigfraud.org> wrote:
>> On 23 May 2019, at 3:55am, Keith Medcalf <kmedc...@dessus.com> wrote: >> > Technically, COLLATE only works on TEXT. Most people declare their own >> types as binary blobs and the programmer has to keep track of what is in >> there and how to work with it. >> >> So it would seem that rather than define a function which turns a value of >> my type into a BLOB, it would be better to create one which turns it into >> some sort of normalised text form. Then I can create whatever COLLATEs I >> need to do my specialised sorting and handling. >> >> IP addresses are easy: convert to the form aaa.bbb.ccc.ddd where each of >> the four parts is always three digits long. > > >Sure. But representing it as 001.001.001.001 for 1.1.1.1 is not usual. >You'd better have a CHECK constraint to enforce your format. >Otherwise lexical ordering won't work with non-expected (but more natural) >1.1.1.1. >While writing a custom collation (the so called "natural ordering") would >work for either format. --DD Microsoft ping fails with 010.116.082.097, 9:45:39.71>ping 010.116.082.097 Ping request could not find host 010.116.082.097. Please check the name and try again. but, works with the normal unzeroed format, 9:45:55.21>ping 10.116.82.97 Pinging 10.116.82.97 with 32 bytes of data: Reply from 10.116.82.97: bytes=32 time<1ms TTL=128 Reply from 10.116.82.97: bytes=32 time<1ms TTL=128 Reply from 10.116.82.97: bytes=32 time<1ms TTL=128 Reply from 10.116.82.97: bytes=32 time<1ms TTL=128 Ping statistics for 10.116.82.97: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms I have been working network for a long time, and I have never seen any application that takes "zeroed left-filled" IP addresses. Just sharing... Thanks. josé _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users