dbTalk Databases Forums  

UUID field in .NET API

sybase.public.sqlanywhere.ultralite sybase.public.sqlanywhere.ultralite


Discuss UUID field in .NET API in the sybase.public.sqlanywhere.ultralite forum.



Reply
 
Thread Tools Display Modes
  #61  
Old   
PGP
 
Posts: n/a

Default Re: UUID field in .NET API - 10-01-2008 , 03:05 PM







"David Fishburn" <fishburn_spam_off (AT) ianywhere (DOT) com> wrote

Quote:
"PGP" <priyesh@do_not_reply> wrote in news:48e396d5@forums-1-dub of
sybase.public.sqlanywhere.ultralite:

P> 2. To test, i generated them (using guidgen, a tool that ships with
P> visual studio), and copy pasted the string in sybase central using the
P> edit on the column.

Interesting.

Can you compare you results to doing something like this:

INSERT INTO your_guid (your_guid_col)
VALUES ( NEWID() );

And see if you get different behaviour.
The NEWID() function is the SQL way of creating a new GUID/UUID.

Here is the result from .NET WriteLine (Guid uid =
dr.GetGuid(1);System.Diagnostics.Debug.WriteLine(u id.ToString())
84d43bac-41bc-467c-b5db-68aaea860602

Here is the one from dbisql (select guid1 from table)
guid1
0xac3bd484bc417c46b5db68aaea860602


Priyesh



Reply With Quote
  #62  
Old   
PGP
 
Posts: n/a

Default Re: UUID field in .NET API - 10-01-2008 , 03:05 PM







"David Fishburn" <fishburn_spam_off (AT) ianywhere (DOT) com> wrote

Quote:
"PGP" <priyesh@do_not_reply> wrote in news:48e396d5@forums-1-dub of
sybase.public.sqlanywhere.ultralite:

P> 2. To test, i generated them (using guidgen, a tool that ships with
P> visual studio), and copy pasted the string in sybase central using the
P> edit on the column.

Interesting.

Can you compare you results to doing something like this:

INSERT INTO your_guid (your_guid_col)
VALUES ( NEWID() );

And see if you get different behaviour.
The NEWID() function is the SQL way of creating a new GUID/UUID.

Here is the result from .NET WriteLine (Guid uid =
dr.GetGuid(1);System.Diagnostics.Debug.WriteLine(u id.ToString())
84d43bac-41bc-467c-b5db-68aaea860602

Here is the one from dbisql (select guid1 from table)
guid1
0xac3bd484bc417c46b5db68aaea860602


Priyesh



Reply With Quote
  #63  
Old   
PGP
 
Posts: n/a

Default Re: UUID field in .NET API - 10-01-2008 , 03:05 PM




"David Fishburn" <fishburn_spam_off (AT) ianywhere (DOT) com> wrote

Quote:
"PGP" <priyesh@do_not_reply> wrote in news:48e396d5@forums-1-dub of
sybase.public.sqlanywhere.ultralite:

P> 2. To test, i generated them (using guidgen, a tool that ships with
P> visual studio), and copy pasted the string in sybase central using the
P> edit on the column.

Interesting.

Can you compare you results to doing something like this:

INSERT INTO your_guid (your_guid_col)
VALUES ( NEWID() );

And see if you get different behaviour.
The NEWID() function is the SQL way of creating a new GUID/UUID.

Here is the result from .NET WriteLine (Guid uid =
dr.GetGuid(1);System.Diagnostics.Debug.WriteLine(u id.ToString())
84d43bac-41bc-467c-b5db-68aaea860602

Here is the one from dbisql (select guid1 from table)
guid1
0xac3bd484bc417c46b5db68aaea860602


Priyesh



Reply With Quote
  #64  
Old   
PGP
 
Posts: n/a

Default Re: UUID field in .NET API - 10-01-2008 , 03:05 PM




"David Fishburn" <fishburn_spam_off (AT) ianywhere (DOT) com> wrote

Quote:
"PGP" <priyesh@do_not_reply> wrote in news:48e396d5@forums-1-dub of
sybase.public.sqlanywhere.ultralite:

P> 2. To test, i generated them (using guidgen, a tool that ships with
P> visual studio), and copy pasted the string in sybase central using the
P> edit on the column.

Interesting.

Can you compare you results to doing something like this:

INSERT INTO your_guid (your_guid_col)
VALUES ( NEWID() );

And see if you get different behaviour.
The NEWID() function is the SQL way of creating a new GUID/UUID.

Here is the result from .NET WriteLine (Guid uid =
dr.GetGuid(1);System.Diagnostics.Debug.WriteLine(u id.ToString())
84d43bac-41bc-467c-b5db-68aaea860602

Here is the one from dbisql (select guid1 from table)
guid1
0xac3bd484bc417c46b5db68aaea860602


Priyesh



Reply With Quote
  #65  
Old   
PGP
 
Posts: n/a

Default Re: UUID field in .NET API - 10-01-2008 , 03:05 PM




"David Fishburn" <fishburn_spam_off (AT) ianywhere (DOT) com> wrote

Quote:
"PGP" <priyesh@do_not_reply> wrote in news:48e396d5@forums-1-dub of
sybase.public.sqlanywhere.ultralite:

P> 2. To test, i generated them (using guidgen, a tool that ships with
P> visual studio), and copy pasted the string in sybase central using the
P> edit on the column.

Interesting.

Can you compare you results to doing something like this:

INSERT INTO your_guid (your_guid_col)
VALUES ( NEWID() );

And see if you get different behaviour.
The NEWID() function is the SQL way of creating a new GUID/UUID.

Here is the result from .NET WriteLine (Guid uid =
dr.GetGuid(1);System.Diagnostics.Debug.WriteLine(u id.ToString())
84d43bac-41bc-467c-b5db-68aaea860602

Here is the one from dbisql (select guid1 from table)
guid1
0xac3bd484bc417c46b5db68aaea860602


Priyesh



Reply With Quote
  #66  
Old   
PGP
 
Posts: n/a

Default Re: UUID field in .NET API - 10-01-2008 , 03:05 PM




"David Fishburn" <fishburn_spam_off (AT) ianywhere (DOT) com> wrote

Quote:
"PGP" <priyesh@do_not_reply> wrote in news:48e396d5@forums-1-dub of
sybase.public.sqlanywhere.ultralite:

P> 2. To test, i generated them (using guidgen, a tool that ships with
P> visual studio), and copy pasted the string in sybase central using the
P> edit on the column.

Interesting.

Can you compare you results to doing something like this:

INSERT INTO your_guid (your_guid_col)
VALUES ( NEWID() );

And see if you get different behaviour.
The NEWID() function is the SQL way of creating a new GUID/UUID.

Here is the result from .NET WriteLine (Guid uid =
dr.GetGuid(1);System.Diagnostics.Debug.WriteLine(u id.ToString())
84d43bac-41bc-467c-b5db-68aaea860602

Here is the one from dbisql (select guid1 from table)
guid1
0xac3bd484bc417c46b5db68aaea860602


Priyesh



Reply With Quote
  #67  
Old   
PGP
 
Posts: n/a

Default Re: UUID field in .NET API - 10-01-2008 , 03:05 PM




"David Fishburn" <fishburn_spam_off (AT) ianywhere (DOT) com> wrote

Quote:
"PGP" <priyesh@do_not_reply> wrote in news:48e396d5@forums-1-dub of
sybase.public.sqlanywhere.ultralite:

P> 2. To test, i generated them (using guidgen, a tool that ships with
P> visual studio), and copy pasted the string in sybase central using the
P> edit on the column.

Interesting.

Can you compare you results to doing something like this:

INSERT INTO your_guid (your_guid_col)
VALUES ( NEWID() );

And see if you get different behaviour.
The NEWID() function is the SQL way of creating a new GUID/UUID.

Here is the result from .NET WriteLine (Guid uid =
dr.GetGuid(1);System.Diagnostics.Debug.WriteLine(u id.ToString())
84d43bac-41bc-467c-b5db-68aaea860602

Here is the one from dbisql (select guid1 from table)
guid1
0xac3bd484bc417c46b5db68aaea860602


Priyesh



Reply With Quote
  #68  
Old   
Mike Vander Ploeg
 
Posts: n/a

Default Re: UUID field in .NET API - 10-01-2008 , 04:41 PM



We are aware of byte ordering issues for UUIDs in 10.0.1. They have been
fixed in version 11, but, unfortunately, there isn't much we can do about it
in 10.0.1

I believe what is happening is that the bytes are getting flipped when
entered from Sybase Central and then flipped again when you fetch them in
dbisql. Explicitly using the uuidtostr() and strtouuid() sql functions when
converting between binaries and strings should workaround the problems in
the implicit conversions. For example:

INSERT INTO tbl1 VALUES( strtouuid(
'5119E812-667D-450a-906D-33A622E04996') )

and

SELECT uuidtostr( guid1 ) FROM tbl1

I believe your .NET code should work fine as it is.

Mike

"PGP" <priyesh@do_not_reply> wrote

Quote:
Mike,

1. It is declared as a unique identifier.

2. To test, i generated them (using guidgen, a tool that ships with visual
studio), and copy pasted the string in sybase central using the edit on
the column.

Priyesh.

"Mike Vander Ploeg" <mvanderp_asdf (AT) sybase (DOT) com> wrote in message
news:48e3901d$1 (AT) forums-1-dub (DOT) ..
Priyesh, I have a couple of questions.

1. How is your UUID column declared? Is it a uniqueidentifier, a
binary, or a varchar?

2. How were the UUIDs originally added to the database?

Mike Vander Ploeg
Sybase iAnywhere





Reply With Quote
  #69  
Old   
Mike Vander Ploeg
 
Posts: n/a

Default Re: UUID field in .NET API - 10-01-2008 , 04:41 PM



We are aware of byte ordering issues for UUIDs in 10.0.1. They have been
fixed in version 11, but, unfortunately, there isn't much we can do about it
in 10.0.1

I believe what is happening is that the bytes are getting flipped when
entered from Sybase Central and then flipped again when you fetch them in
dbisql. Explicitly using the uuidtostr() and strtouuid() sql functions when
converting between binaries and strings should workaround the problems in
the implicit conversions. For example:

INSERT INTO tbl1 VALUES( strtouuid(
'5119E812-667D-450a-906D-33A622E04996') )

and

SELECT uuidtostr( guid1 ) FROM tbl1

I believe your .NET code should work fine as it is.

Mike

"PGP" <priyesh@do_not_reply> wrote

Quote:
Mike,

1. It is declared as a unique identifier.

2. To test, i generated them (using guidgen, a tool that ships with visual
studio), and copy pasted the string in sybase central using the edit on
the column.

Priyesh.

"Mike Vander Ploeg" <mvanderp_asdf (AT) sybase (DOT) com> wrote in message
news:48e3901d$1 (AT) forums-1-dub (DOT) ..
Priyesh, I have a couple of questions.

1. How is your UUID column declared? Is it a uniqueidentifier, a
binary, or a varchar?

2. How were the UUIDs originally added to the database?

Mike Vander Ploeg
Sybase iAnywhere





Reply With Quote
  #70  
Old   
Mike Vander Ploeg
 
Posts: n/a

Default Re: UUID field in .NET API - 10-01-2008 , 04:41 PM



We are aware of byte ordering issues for UUIDs in 10.0.1. They have been
fixed in version 11, but, unfortunately, there isn't much we can do about it
in 10.0.1

I believe what is happening is that the bytes are getting flipped when
entered from Sybase Central and then flipped again when you fetch them in
dbisql. Explicitly using the uuidtostr() and strtouuid() sql functions when
converting between binaries and strings should workaround the problems in
the implicit conversions. For example:

INSERT INTO tbl1 VALUES( strtouuid(
'5119E812-667D-450a-906D-33A622E04996') )

and

SELECT uuidtostr( guid1 ) FROM tbl1

I believe your .NET code should work fine as it is.

Mike

"PGP" <priyesh@do_not_reply> wrote

Quote:
Mike,

1. It is declared as a unique identifier.

2. To test, i generated them (using guidgen, a tool that ships with visual
studio), and copy pasted the string in sybase central using the edit on
the column.

Priyesh.

"Mike Vander Ploeg" <mvanderp_asdf (AT) sybase (DOT) com> wrote in message
news:48e3901d$1 (AT) forums-1-dub (DOT) ..
Priyesh, I have a couple of questions.

1. How is your UUID column declared? Is it a uniqueidentifier, a
binary, or a varchar?

2. How were the UUIDs originally added to the database?

Mike Vander Ploeg
Sybase iAnywhere





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.