Thanks. After I wrote a method last night to convert the UUID into something meaningful I got a message from TinyTDS's maintainer telling me to check a few things out. I had seemed to remember not having this problem earlier this year and I was right.
In order to get FreeTDS working with with PHP on this machine I had to feed it some less than optimal configuration options at compile time and use an older version (.82). That was the problem. I moved that to its own little directory, did a stock Homebrew install (.91) and everything is working on both fronts. So this was kind of an edge case. Again, thanks for the help. Now I can go back to griping about PHP today. On Oct 14, 8:19 pm, Jeremy Evans <[email protected]> wrote: > On Oct 14, 6:42 pm, cult hero <[email protected]> wrote: > > > I'm in the process of evaluating Sequel for working with an existing > > database (i.e. any opinions about the structure don't matter because > > it is what it is). One of the databases is PostgreSQL and the other is > > MSSQL. > > > In PostgreSQL I can migrate a database with the type ":uuid" I get a > > string representation of that UUID back when I query the DB. So, > > "B016F9B6-7E41-4B94-9EA1-75C5FCEC9D89" is what I get and that, for the > > most part, works. > > This appears to be how PostgreSQL returns UUIDs: > > SELECT 'a0eebc999c0b4ef8bb6d6bb9bd380a11'::uuid; > uuid > -------------------------------------- > a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11 > > > When dealing with a UUID in MSSQL however, I get something that looks > > like this: "\xB6\xF9\x16\xB0A~\x94K\x9E\xA1u\xC5\xFC\xEC\x9D\x89" > > That's probably the UUID in binary form. > > > Is the PostgreSQL driver returning a string or is Sequel doing the > > conversion? > > PostgreSQL. It's not the ruby driver either, it's just how PostgreSQL > returns things (the above example is the output from psql). > > > I could be wrong, but since internally the UUID isn't > > stored as a string with PostgreSQL it seems odd to be returning a > > string. > > There are a lot of types that PostgreSQL doesn't store as strings but > are returned as strings (dates, timestamps, etc.). > > > If Sequel is doing it, can you point me to where so I can make a > > similar change for MSSQL? > > > (If it's the driver I already posted something over on the TinyTDS > > project page about it.) > > Sequel doesn't do it's own typecasting in the tinytds adapter (leaving > it to TinyTDS), so it would have to be done in TinyTDS. > > Of course, if you are using models, it should be easy to handle things > but adding an after_initialize hook that does the conversion. > Alternatively, for datasets, you could use a custom row_proc that does > the conversion. > > Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
