Query of Queries in CF7 crashes code from CF5

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Query of Queries in CF7 crashes code from CF5

    If anyone has a suggestion to this question, I would be most appreciative.

    In CF5, I was using a query to show current logged in users within our web
    site.

    Since, we upgraded to CF7, the entire interface does not work.

    HERE IS THE ERROR....

    Error Executing Database Query.
    Query Of Queries runtime error.
    Table named "server.qusers" was not found in Memory. It is misspelled, or the
    table is not defined.

    <cfquery name="qshowusers" dbtype="query">
    select sUser, AppName, Max(RequestTime) as LastReq, Count(sUser) as Hits
    from server.qusers
    </cfquery>


    In the CFQUERY what does 'server.qusers' refer to? I believe 'server' has to
    be the query name that has been executed before and this query name has to be
    specified for the query of query.

    I can't find a CFQUERY with name ="server" which executes before this query
    of query.

    Thanks in advance for any help you might give to this.

    <cflock timeout="30" type="EXCLUSIVE" scope="application">
    <cfquery name="qshowusers" dbtype="query">
    select sUser, AppName, Max(RequestTime) as LastReq, Count(sUser) as Hits
    from server.qusers
    group by sUser, AppName
    order by LastReq desc
    </cfquery>
    <cfset totalhits = server.qusers.recordcount>
    </cflock>

    <cfset dbsize = 0>
    <cfset rownum = 0>
    <cfoutput query="qshowusers">
    <cfset dbsize = dbsize + qShowUsers.Hits>
    <cfset elapsed = CreateODBCTime(now()) - qshowusers.LastReq>
    <cfif TimeFormat(elapsed,'m') lt 15>
    <cfset rownum = rownum + 1>
    </cfif>
    </cfoutput>

    boopower Guest

  2. Similar Questions and Discussions

    1. Query of Queries
      I think that we're using 5 on both environments (not checked that though - they shouldn't be different anyway)... It seems that i've fixed it......
    2. 2 queries to 1 query
      Hello, Can somebody help me to combine these two queries into one query. <cfquery datasource="#DATAS#" name="getMainNav"> SELECT * FROM...
    3. Query of Queries on query New type query
      In CF5 we have a page that creates a query, using queryNew and querySetCell and the like, we then used dbtype="query" and gave it's name so we could...
    4. Query of Queries?
      I have a table named therapists with a field named modalities which contains a comma delimited list of id #s. I need to loop through a list of...
    5. Urgent Help Needed ! JDBC driver crashes after 200 queries
      Hi all, We have a major problem and need help. I've written a testing program which has several pieces of sql which we execute in a loop. After 191...
  3. #2

    Default Re: Query of Queries in CF7 crashes code from CF5

    Server is a scope, like Application, Session, Form and URL. It appears that the
    query that is being queried has been saved in the server scope.

    This could have occurred in many places but I'd look in the Application.cfm
    file.

    I take it you did not build this app yourself? Do you not have any
    documentation.

    Stressed_Simon Guest

  4. #3

    Default Re: Query of Queries in CF7 crashes code from CF5

    Yeah, I don't think saving things into the Server scope is allowed anymore? If you need something to stay available all the time then save it in the Application scope.
    Cannikinn Guest

  5. #4

    Default Re: Query of Queries in CF7 crashes code from CF5

    Here is the code in its entirety:

    <!---
    Custom Tag Name: TrackUsers.cfm
    Author: Bruce Van Horn, Netsite Dynamics LLC
    Email: [email]Bruce@NetsiteDynamics.com[/email]
    Date: October 11, 2001

    Purpose: To allow users to keep track of active users on a server

    Requirements: ColdFusion 5.0 or higher

    Attributes:
    User (required) = "a unique identifier for this user like IP number or
    SessionID"
    AppName (required) = "Name of the application calling this tag"

    Usage Example:
    Place this tag in every Application.cfm page on your sever:

    <CF_TrackUsers User="#cgi.remote_addr#" AppName="MyApp">

    --->

    <cflock timeout="30" throwontimeout="No" type="EXCLUSIVE" scope="APPLICATION">
    <cfif (not isDefined("Server.qUsers")) OR (NOT IsQuery(Server.qUsers))>
    <cfscript>
    Server.qUsers = QueryNew("User,AppName,RequestTime");
    QueryAddRow(Server.qUsers);
    QuerySetCell(Server.qUsers,"User",Attributes.User) ;
    QuerySetCell(Server.qUsers,"AppName",Attributes.Ap pName);
    QuerySetCell(Server.qUsers,"RequestTime",CreateODB CTime(now()));
    </cfscript>
    <cfelse>
    <cfquery name="qMaxReq" dbtype="query">
    select max(requesttime) as lastreq, Count(User) AS RowCount
    from Server.qusers
    </cfquery>
    <cfset ElapsedTime = CreateODBCTime(now()) - qMaxReq.LastReq>
    <cfif (TimeFormat(Variables.ElapsedTime,'m') gt 15) OR (qMaxReq.RowCount gt
    350)>
    <cfscript>
    Server.qUsers = "";
    Server.qUsers = QueryNew("User,AppName,RequestTime");
    </cfscript>
    </cfif>
    <cfscript>
    QueryAddRow(Server.qUsers);
    QuerySetCell(Server.qUsers,"User",Attributes.User) ;
    QuerySetCell(Server.qUsers,"AppName",Attributes.Ap pName);
    QuerySetCell(Server.qUsers,"RequestTime",CreateODB CTime(now()));
    </cfscript>
    </cfif>
    </cflock>


    Here is the error:

    Error Occurred While Processing Request
    Error Executing Database Query.

    Query Of Queries syntax error.
    Encountered "Count ( User. Incorrect Select List,

    The error occurred in D:\CFusionMX7\CustomTags\TrackUsers.cfm: line 32
    Called from
    D:\virtualwww\site_effects\clients\mis_splash\mis_ v2\Application.cfm: line 127
    Called from D:\CFusionMX7\CustomTags\TrackUsers.cfm: line 32
    Called from
    D:\virtualwww\site_effects\clients\mis_splash\mis_ v2\Application.cfm: line 127

    30 : </cfscript>
    31 : <cfelse>
    32 : <cfquery name="qMaxReq" dbtype="query">
    33 : select max(requesttime) as lastreq, Count(User) AS RowCount
    34 : from Server.qusers




    --------------------------------------------------------------------------------

    SQL select max(requesttime) as lastreq, Count(User) AS RowCount from
    Server.qusers

    Please try the following:
    Check the ColdFusion documentation to verify that you are using the correct
    syntax.
    Search the Knowledge Base to find a solution to your problem.


    Browser Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
    Remote Address 69.153.221.90
    Referrer
    Date/Time 25-May-05 11:57 AM

    Stack Trace (click to expand)
    at
    cfTrackUsers2ecfm1515940139.runPage(D:\CFusionMX7\ CustomTags\TrackUsers.cfm:32)
    at
    cfApplication2ecfm695863572.runPage(D:\virtualwww\ site_effects\clients\mis_splas
    h\mis_v2\Application.cfm:127) at
    cfTrackUsers2ecfm1515940139.runPage(D:\CFusionMX7\ CustomTags\TrackUsers.cfm:32)
    at
    cfApplication2ecfm695863572.runPage(D:\virtualwww\ site_effects\clients\mis_splas
    h\mis_v2\Application.cfm:127)


    java.sql.SQLException: <br><b>Query Of Queries syntax error.</b><br>
    Encountered "Count ( User.
    Incorrect Select List,

    at coldfusion.sql.imq.jdbcStatement.parseSQL(jdbcStat ement.java:566)
    at coldfusion.sql.imq.jdbcStatement.fetchResult(jdbcS tatement.java:536)
    at coldfusion.sql.imq.jdbcStatement.execute(jdbcState ment.java:131)


    Thanks again for your help!


    boopower Guest

  6. #5

    Default Re: Query of Queries in CF7 crashes code from CF5

    I changed the variables from server. to application. and stil get the following
    error using the following code.

    Any suggestions would be greatly appreciated.

    CODE
    _____________________

    <cflock timeout="30" throwontimeout="No" type="EXCLUSIVE" scope="APPLICATION">
    <cfif (not isDefined("Application.qUsers")) OR (NOT
    IsQuery(Application.qUsers))>
    <cfscript>
    Application.qUsers = QueryNew("User,AppName,RequestTime");
    QueryAddRow(Application.qUsers);
    QuerySetCell(Application.qUsers,"User",Attributes. User);
    QuerySetCell(Application.qUsers,"AppName",Attribut es.AppName);
    QuerySetCell(Application.qUsers,"RequestTime",Crea teODBCTime(now()));
    </cfscript>
    <cfelse>
    <cfquery name="qMaxReq" dbtype="query">
    select max(requesttime) as lastreq, Count(User) AS RowCount
    from Application.qusers
    </cfquery>
    <cfset ElapsedTime = CreateODBCTime(now()) - qMaxReq.LastReq>
    <cfif (TimeFormat(Variables.ElapsedTime,'m') gt 15) OR (qMaxReq.RowCount gt
    350)>
    <cfscript>
    Application.qUsers = "";
    Application.qUsers = QueryNew("User,AppName,RequestTime");
    </cfscript>
    </cfif>
    <cfscript>
    QueryAddRow(Application.qUsers);
    QuerySetCell(Application.qUsers,"User",Attributes. User);
    QuerySetCell(Application.qUsers,"AppName",Attribut es.AppName);
    QuerySetCell(Application.qUsers,"RequestTime",Crea teODBCTime(now()));
    </cfscript>
    </cfif>
    </cflock>

    ERROR MESSAGE
    ______________________________

    Error Occurred While Processing Request
    Error Executing Database Query.

    Query Of Queries syntax error.
    Encountered "Count ( User. Incorrect Select List,

    The error occurred in D:\CFusionMX7\CustomTags\TrackUsersNew.cfm: line 32
    Called from
    D:\virtualwww\site_effects\clients\mis_splash\mis_ v2\admin\no_app\test_filewrite
    \Application.cfm: line 6
    Called from D:\CFusionMX7\CustomTags\TrackUsersNew.cfm: line 32
    Called from
    D:\virtualwww\site_effects\clients\mis_splash\mis_ v2\admin\no_app\test_filewrite
    \Application.cfm: line 6

    30 : </cfscript>
    31 : <cfelse>
    32 : <cfquery name="qMaxReq" dbtype="query">
    33 : select max(requesttime) as lastreq, Count(User) AS RowCount
    34 : from Application.qusers




    --------------------------------------------------------------------------------

    SQL select max(requesttime) as lastreq, Count(User) AS RowCount from
    Application.qusers

    Please try the following:
    Check the ColdFusion documentation to verify that you are using the correct
    syntax.
    Search the Knowledge Base to find a solution to your problem.


    Browser Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
    Remote Address 69.153.221.90
    Referrer
    Date/Time 25-May-05 03:05 PM

    Stack Trace (click to expand)
    at
    cfTrackUsersNew2ecfm683469455.runPage(D:\CFusionMX 7\CustomTags\TrackUsersNew.cfm
    :32) at
    cfApplication2ecfm1007178053.runPage(D:\virtualwww \site_effects\clients\mis_spla
    sh\mis_v2\admin\no_app\test_filewrite\Application. cfm:6) at
    cfTrackUsersNew2ecfm683469455.runPage(D:\CFusionMX 7\CustomTags\TrackUsersNew.cfm
    :32) at
    cfApplication2ecfm1007178053.runPage(D:\virtualwww \site_effects\clients\mis_spla
    sh\mis_v2\admin\no_app\test_filewrite\Application. cfm:6)


    java.sql.SQLException: <br><b>Query Of Queries syntax error.</b><br>
    Encountered "Count ( User.
    Incorrect Select List,

    at coldfusion.sql.imq.jdbcStatement.parseSQL(jdbcStat ement.java:566)
    at coldfusion.sql.imq.jdbcStatement.fetchResult(jdbcS tatement.java:536)





    boopower 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