servoy uuid generator

Questions and answers regarding general SQL and backend databases

servoy uuid generator

Postby rogel » Tue Oct 11, 2011 5:39 am

hi! How does servoy uuid generator work? Will it not generate "_" as part of the id? Why does it need 36 in text size?
rogel
 
Posts: 264
Joined: Mon Jul 04, 2011 9:09 am

Re: servoy uuid generator

Postby rgansevles » Tue Oct 11, 2011 8:46 am

Rogel,

You can use text(36) or media(16) column types with UUID in Servoy.
In case of text, the dashes are also in the data, it is just the string representation of the UUID.

Note that you have to set the UUID flag on the column in the table editor.

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: servoy uuid generator

Postby rogel » Wed Oct 12, 2011 12:12 am

rgansevles wrote:Rogel,

You can use text(36) or media(16) column types with UUID in Servoy.
In case of text, the dashes are also in the data, it is just the string representation of the UUID.
Rob

How about other special characters like underscores "_", slashes"/ or \". Is it possible that these characters be in the generated uuid as well?


Note that you have to set the UUID flag on the column in the table editor.

The foreign key column should have its UUID flag set as well?
rogel
 
Posts: 264
Joined: Mon Jul 04, 2011 9:09 am

Re: servoy uuid generator

Postby rgansevles » Wed Oct 12, 2011 8:43 am

Rogel,

We use the standard java UUID generator which generates type 4: http://en.wikipedia.org/wiki/Universall ... identifier

The UUID flag has to be set on all columns that contain UUID, so also fk.

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: servoy uuid generator

Postby rogel » Fri Oct 14, 2011 12:25 am

rgansevles wrote:Rogel,

We use the standard java UUID generator which generates type 4: http://en.wikipedia.org/wiki/Universall ... identifier

The UUID flag has to be set on all columns that contain UUID, so also fk.

Rob


Thanks Rob.

What will happen to my existing data? We shifted from Integer to Text and Servoy Sequence to UUID. I believe loadRecords(<numeric>) will not work. If I replace it with application.getUUID(<non-uuid-generated>), it does not work as well? What if other systems place data into our database and we would like to retrieve the records in our system.

The solution that I think is...
    pkcolumn will remain text
    pkcolumn sequence type is blank
    for every new record, set the primary key column to application.getUUID()

is there another servoy way to accomplish this?
rogel
 
Posts: 264
Joined: Mon Jul 04, 2011 9:09 am

Re: servoy uuid generator

Postby rgansevles » Fri Oct 14, 2011 8:56 am

Rogel,

I don't understand what you are trying to do.

You had a pk int-servoyseq and you replaced that with text-uuidgenerator?
In that case loadRecords(uuid) should work.
Obviously, you cannot retrieve the records by old pk since (i guess) all numeric pks are replaced with a uuid value.

If other systems put data with uuids in your system, that should be fine, same as for any other key type.


Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: servoy uuid generator

Postby rogel » Mon Oct 17, 2011 12:14 am

rgansevles wrote:Rogel,

I don't understand what you are trying to do.

You had a pk int-servoyseq and you replaced that with text-uuidgenerator?
In that case loadRecords(uuid) should work.
Obviously, you cannot retrieve the records by old pk since (i guess) all numeric pks are replaced with a uuid value.

If other systems put data with uuids in your system, that should be fine, same as for any other key type.
Rob


e.g.
Code: Select all
website
id="37F3CB42-26FC-4CE3-935F-3E804044B719"
value="www.yahoo.com"
id="1" <-- existing record before changing int-servoyseq to text-uuidgenerator
value="www.google.com"


in my code
Code: Select all
loadRecord(application.getUUID("1"))
will not return record with id="1"?
rogel
 
Posts: 264
Joined: Mon Jul 04, 2011 9:09 am

Re: servoy uuid generator

Postby rgansevles » Mon Oct 17, 2011 8:43 am

application.getUUID() converts the parameter (that can be string or byte array) to an UUID object.
It can't do that for value "1".

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL


Return to SQL Databases

Who is online

Users browsing this forum: No registered users and 27 guests