Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
boopower #1
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
-
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 queries to 1 query
Hello, Can somebody help me to combine these two queries into one query. <cfquery datasource="#DATAS#" name="getMainNav"> SELECT * FROM... -
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... -
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... -
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... -
Stressed_Simon #2
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
-
Cannikinn #3
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
-
boopower #4
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
-
boopower #5
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



Reply With Quote

