coldfusion converts GUID to binary

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default coldfusion converts GUID to binary

    here's a simple stored procedure

    CREATE PROCEDURE guidTEST
    AS
    SELECT newID() as guidTEST,
    '8B710BAD-2F8C-42AA-BA67-8984CBA81BD6' as guidTEST2

    when i run this sproc from the query analyzer (exec guidTEST)
    it returns, as expected, a query with a new GUID and the 2nd GUID as a string

    BUT, when I run this:

    <cfstoredproc procedure="guidTEST" datasource="test">
    <cfprocresult resultset="1" name="test">
    </cfstoredproc>
    <cfdump var="#test#">

    the first column is converted to binary, (the second column is still a string).
    how do i make sure the first col stay returns as a string?

    i'm running CF7, SQL2000, apache

    THANKS!!

    JJBBDD Guest

  2. Similar Questions and Discussions

    1. GUID and CFProcParam
      I have a new client who is using GUID's as the primary key of their Customer table rather than the integer that most of my other clients use. When...
    2. GUID question
      Hi, What is a GUID exactly. Is it a unique identifier that the environment assigns you or does it take your password and encrypt it? Does it...
    3. Retrieving GUID from DB2 UDB
      Bill Homan <member35043@dbforums.com> wrote in message news:<3203554.1060104571@dbforums.com>... What is actually in the CHAR(16) FOR BIT DATA...
    4. GUID as a parameter
      Why are you dynamically creating the parameter name? Should this not be fixed and you just pass in myTable.myGuid? "Ian Williamson"...
    5. 64 bit binary and 32 bit binary have different result. Is it library bug or compiler bug?
      #include <errno.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include <dirent.h> #include <assert.h> int main(int argc, char...
  3. #2

    Default Re: coldfusion converts GUID to binary

    SELECT
    CAST (newID() AS varchar(55)) as guidTEST

    MikerRoo Guest

  4. #3

    Default Re: coldfusion converts GUID to binary

    thanks... i'm wondeirng if there's anything that would work as a global
    solution since there are a ton of instances in which i grab GUIDs from the db.

    also, actually, i was a little bit off here. apparently cf 6 and above convert
    GUIDs to bytearrays. what's strange is that this problem isn't happening on the
    production server. it's only occuring on my local dev machine. is there some
    global setting that i'm missing that automatically converts bytearrays to
    strings? or perhaps a setting on the database side thate ensures more friendly
    encoding of GUIDs?

    if not, can someone recommend a workaround that will let me convert the
    bytearrays when i need to?

    thanks

    -j

    JJBBDD Guest

  5. #4

    Default Re: coldfusion converts GUID to binary

    <blockquote>quote:<br><hr><i>Originally posted by: <b><b>JJBBDD</b></b></i>
    ... if not, can someone recommend a workaround that will let me convert the
    bytearrays when i need to?<hr></blockquote>
    See the post above!

    Anyway, you are quite incorrect, "CF6 and above" does not "convert GUIDs to
    bytearrays". If you examine the type of the returned column it is
    "uniqueidentifier" but it normally behaves just like a string in CF. Output
    and string functions work just as on any string.

    Anyway, you're a fool if you use GUIDs. Google "COMB GUIDS".

    COMB GUID's would be the global workaround you asked for.


    MikerRoo Guest

  6. #5

    Default Re: coldfusion converts GUID to binary

    okay, i can cast the guid as a string it it works....

    unfortunately, this won't work as a solution for me because I'm dealing with a
    legacy app that passes a ton of GUIDs back and forth to the DB.

    i'm running CF7, SQL2000, apache locally. the production site uses CF6.1. The
    only thing I can think of is that 6.1 interprets GUIDs differently than 7. Can
    anyone else even replicate this issue? I'm confused and have been serching for
    a week with no luck.



    JJBBDD Guest

  7. #6

    Default Re: coldfusion converts GUID to binary

    You can try running "SELECT @@OPTIONS" against both databases and see if there
    are any differences.

    But the fact is GUIDS become strings the moment you use them in CF6 and 7.

    Attach the EXACT error mmessagge you get and the code that generated it.



    MikerRoo Guest

  8. #7

    Default Re: coldfusion converts GUID to binary

    mike-- thanks for sticking with me on this. i've posted this issue to some
    other forums with no luck.

    i tired select@@ options...
    my dev box returned 5496
    the production box returned 1080
    (note, the production box is running sql 7)

    here are 2 screen shots of the error, the stack, and a dump of the relevant
    query-- in the dump, it labels the 2 GUIDs as binary objects, but i think they
    are byte arrays (at least, they certainly are not binary, and when I run
    anything on them, coldfusion tells me what i'm doing will not work with byte
    arrays)

    <a target=_blank class=ftalternatingbarlinklarge
    href="http://www.thepokerhound.com/bpoerror.gif
    [url]http://www.thepokerhound.com/stackerr.gif[/url]

    also,">[url]http://www.thepokerhound.com/bpoerror.gif[/url]
    [url]http://www.thepokerhound.com/stackerr.gif[/url]

    also,</a> it occurs to me that the problem may be because I'm using an ODBC
    connection... i could not get the standard sql server connector to work
    (presumably JDBC), and they are a number of posts that suggest the ODBC
    workaround.

    thanks again.



    JJBBDD Guest

  9. #8

    Default Re: coldfusion converts GUID to binary

    Yes, the ODBC driver is the problem. Sorry I forgot to ask but that is a
    non-standard configuration and you didn't state that SQL server 7 was involved.

    Anyway, goto CF administrator and createnew data sources using the "Microsoft
    SQL server" type. Then delete the ODBC sources both in CF and the control
    panel -- they are a security risk.

    Using CF's drivers, you will see superior performance and the GUID's will
    behave normally (act as strings when you need them to).

    BTW the @@option differences translate to CONCAT_NULL_YIELDS_NULL,
    QUOTED_IDENTIFIER, and ARITHABORT settings (or at least they would if both
    servers were MSSQL 2000). The dev box is set more correctly but none of
    these settings have a bearing on your guid problem.


    MikerRoo Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139