SPAM: Re: [Mono-list] Re: [Mono-devel-list] Mono.Data.ProvidersFactory

Michael J. Ryan tracker1_lists at theroughnecks.com
Mon Mar 21 17:12:25 EST 2005


Aleksandar Dezelin wrote:
> I want to ask you this:
> 
> I have MSSQL server database table with uniqueidentifier filed types,
> I want to move my application from MSSQL to PostgreSQL. As you
> probably know, PostgreSQL doesn't support uniqueidentifiers. Does
> AdpSqlClient transform C# Guid data type to string or some other
> PostgreSQL db type automaticly?

I use BYTEA as the storage type in Postgre, for parameterized queries,
you can use myGuid.ToByteArray() for the inserts... and
myGuid = new Guid((byte[])DataTable.Rows[i]["myGuid"]);
for reading it back out...

If you need encoding for non-parameterized queries, let me know, I have a 
little utility class that I put encoding Guid to octets string for Postgre
into.. :)  was thinking on contacting the Npgsql maintainer on this, so
that it could be supported via the Npgsql interface, to just pass a Guid
to the BYTEA type, and have it do the ToByteArray() internally.

-- 
Michael J. Ryan - tracker1(at)theroughnecks(dot)com - www.theroughnecks.net
icq: 4935386  -  AIM/AOL: azTracker1  -  Y!: azTracker1  -  MSN/Win: (email)




More information about the Mono-devel-list mailing list