Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Generating UUIDs in older versions of Genero  (Read 9343 times)
Jim M.
Posts: 5


« on: March 18, 2016, 10:17:00 pm »

This is very similar to my MD5 question (thank you to everyone who took time to reply)

I need to generate a UUID and in 2.5 I am using security.RandomGenerator.CreateUUIDString

But in 2.32 and 2.21 this isn't available. 

Any suggestions on the best option for generating UUIDS in these versions?

I know I can use SQL Server to generate them (but will also need this in Informix) and I know there are free components  and websites for generating UUIDs. 

But I'm still wondering if there is something in these Genero versions that I'm missing.
Leo S.
Four Js
Posts: 126


« Reply #1 on: March 18, 2016, 11:31:48 pm »

IMPORT JAVA java.util.UUID
MAIN
  DISPLAY UUID.randomUUID();
END MAIN

to avoid blowing your memory with a full Java VM if you only need this one function from java you can call this 4 liner with a Channel function
HTH and Regards, Leo
Reuben B.
Four Js
Posts: 1046


« Reply #2 on: March 20, 2016, 10:17:58 pm »

If you want to avoid Java and use a 100% Genero solution in the situation you describe, if there is no UI involved, you can do something like

- download and install latest version of Genero onto server (install into separate directory)

- compile and run a small program with the new functionality using this version

Code
  1. #! uuidstring.4gl
  2. IMPORT security
  3. MAIN
  4.    DISPLAY security.RandomGenerator.CreateUUIDString()
  5. END MAIN

- with your existing programs compiled and run using 2.21,2.30 etc, something like ...

Code
  1. FUNCTION get_uuidstring()
  2. DEFINE ch base.Channel
  3. DEFINE s STRING
  4.    LET ch = base.Channel.create()
  5.    CALL ch.openPipe("cd opt/fourjs/fgl/3.00.10; . ./envcomp; fglrun uuidstring","u")  #may need to set FGLLDPATH as well
  6.    LET s = ch.readLine()
  7.    CALL ch.close()
  8.    RETURN s
  9. END FUNCTION

or alternatively create a RESTful web service to provide the information.
 
Also I'll make sure you are aware, old version of the documentation and product are available under "Archived Releases" bottom right corner of the products download page https://4js.com/en/download/products.

Personally I'd rather you upgraded so you weren't using 2.20, 2.30 but were using 3.0.  2.20 must be 7 years old now so you are missing out on 7 years of our development teams efforts in this and other areas. As you've discovered its frustrating when there is stuff you want to use but it is in a more recent version.

Reuben

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines