Skip to main content
Inspiring
May 29, 2007
Answered

Passing a UUID through URL

  • May 29, 2007
  • 6 replies
  • 1622 views
I am having trouble passing a CreateUUID() through a URL because of the hyphens

Is there a quick and easy way to get around this or do I need a script that will strip hyphens for the URL, and then add the hyphens back in once the page has changed locations?

thanks for your comments in advance
    This topic has been closed for replies.
    Correct answer sjlsam2
    by using single quotes around my variable in the cfquery i was able to solve my problem!
    sorry for the hassle, thanks for your responses!!

    6 replies

    Inspiring
    May 30, 2007
    Better yet, use <cfqueryparam>
    Inspiring
    May 29, 2007
    Adam Cameron wrote:
    >> i pass this
    >> &selection=D8660E35-1372-69E5-F732112DB40A7696
    >>
    >> and get this
    >> [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC SQL Server
    >> Driver][SQL Server]Invalid column name 'D8660E35'.
    >>
    >> i guess this is more of a sql problem than a CF problem
    >
    > Yeah. Your query sounds screwed, as if you're using the VALUE (ie: the
    > UUID in this case) in place of a column name. Which is what the error
    > suggests.
    >
    > What's your query SQL?
    >

    Actually that is the error one gets when one forgets the quotes around a
    string with dashes in it. The SQL parser is trying to subtract what it
    perceives as one column name "D8660E35" from what it perceives as
    another "1372".

    Try putting single quotes around your string value.

    Inspiring
    May 29, 2007
    > i pass this
    > &selection=D8660E35-1372-69E5-F732112DB40A7696
    >
    > and get this
    > [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC SQL Server
    > Driver][SQL Server]Invalid column name 'D8660E35'.
    >
    > i guess this is more of a sql problem than a CF problem

    Yeah. Your query sounds screwed, as if you're using the VALUE (ie: the
    UUID in this case) in place of a column name. Which is what the error
    suggests.

    What's your query SQL?

    --
    Adam
    sjlsam2AuthorCorrect answer
    Inspiring
    May 29, 2007
    by using single quotes around my variable in the cfquery i was able to solve my problem!
    sorry for the hassle, thanks for your responses!!
    Inspiring
    May 29, 2007
    > I am having trouble passing a CreateUUID() through a URL because of the hyphens

    There's nothing wrong with having hyphens in a URL
    ( http://tools.ietf.org/html/rfc3986#section-2.3). Well there shouldn't be.
    And, indeed, we use UUIDs on URLs all the time, and nary a problem.

    What is this problem you are perceiving you are having?

    --
    Adam
    Inspiring
    May 29, 2007
    Try using the URLEncodedFormat and URLDecode functions.
    On the page where the UUID is being created:
    <cfset myUUID = CreateUUID()/>
    <cfoutput>#URLEncodedFormat(myUUID)#</cfoutput>
    On the page that needs to read the variable:
    <cfoutput>#URLDecode(myUUID)#</cfoutput>