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

  1. #1

    Default cfqueryparam usage

    Hello,

    Ive been tightening up my querys using the cfqueryparam tag and it does also
    seem to help greatly with speed.

    Is it worth using cfqueryparam on ALL variables handed in to a query then?
    (even in inserts and updates if this is possible?) i.e.

    <cfquery name="myquery" datasource="myDB">
    INSERT INTO people (Name, Age)
    VALUES (<cfqueryparam value="InputName" cfsqltype="cf_sql_char">,
    <cfqueryparam value="InputAge" cfsqltype="cf_sql_integer">)
    </cfquery>

    or...

    <cfquery name="myquery" datasource="myDB">
    UPDATE people SET Age = <cfqueryparam value="NewInputAge"
    cfsqltype="cf_sql_integer">
    WHERE Name = <cfqueryparam value="InputName" cfsqltype="cf_sql_char">
    </cfquery>

    Some of the bigger queries are going to start looking mighty complex then.....
    but if it speeds it up....


    Clacker Guest

  2. Similar Questions and Discussions

    1. Error With CFQUERYPARAM
      Here is an error that only exists when cfqueryparam is used. The code below throws an error in the *second* query if the *first* query contains...
    2. cfqueryparam
      Hi, I am trying to take values passed through a form and do a search based on that, but I am getting an error Error Executing Database Query....
    3. CFQUERYPARAM Error
      Hello, I am using MX7 and am having problems with cfqueryparam. I am new to a project and the old code does not use them and everything I have...
    4. cfqueryparam question
      Hi, all. I am not too sure where to put the cfqueryparam in my code below. Alos for for this code: where id =...
    5. cfqueryPARAM problem
      Viva Coldfusion Forum - 'Kudos to all who help out in the time of trouble for they shall be rescued in theirs' I am concatenating an sql statement...
  3. #2

    Default Re: cfqueryparam usage

    How fast does it take you to insert or update a record now?
    Dan Bracuk Guest

  4. #3

    Default Re: cfqueryparam usage

    CFQUERYPARAM uses bind variables (if your database supports them) which should
    provide a speed increase for queries that are executed multiple times because
    the execution plans can be reused. Whether or not to use it is your decision,
    but MM also recommends using it for security reasons as well as performance.

    mxstu 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