v 1.6.0 /model/content/ContentService.cfc

Hello,

we just migrated one of our sites from ACF to Railo running CB 1.6. Now I realized that catalina.out filles up with errors

`

com.microsoft.sqlserver.jdbc.SQLServerException: Die Anweisung muss ausgeführt werden, bevor Ergebnisse abgerufen werden können.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getGeneratedKeys(SQLServerStatement.java:2040)
at com.intergral.fusionreactor.jdbc.StatementSurrogate.getGeneratedKeys(StatementSurrogate.java:465)
at railo.runtime.db.driver.StatementProxy.getGeneratedKeys(StatementProxy.java:127)
at railo.runtime.type.QueryImpl.setGeneratedKeys(QueryImpl.java:287)
at railo.runtime.type.QueryImpl.(QueryImpl.java:243)
at railo.runtime.tag.Query.executeDatasoure(Query.java:696)
at railo.runtime.tag.Query.doEndTag(Query.java:532)
at org.railo.cfml.base_cfc$cf.udfCall1(/org/railo/cfml/base.cfc:147)
at org.railo.cfml.base_cfc$cf.udfCall(/org/railo/cfml/base.cfc)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:93)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:307)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:208)
at railo.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:748)
at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:724)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1549)
at org.railo.cfml.query_cfc$cf.udfCall(/org/railo/cfml/query.cfc:35)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:93)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:307)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:208)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:623)
at railo.runtime.ComponentImpl._call(ComponentImpl.java:506)
at railo.runtime.ComponentImpl.call(ComponentImpl.java:1738)
at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:724)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1549)
at model.content.contentservice_cfc$cf.udfCall3(/contentbox/model/content/ContentService.cfc:618)
at model.content.contentservice_cfc$cf.udfCall(/contentbox/model/content/ContentService.cfc)
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:93)
at railo.runtime.type.UDFImpl._call(UDFImpl.java:307)
at railo.runtime.type.UDFImpl.call(UDFImpl.java:208)
at railo.runtime.ComponentScopeShadow.call(ComponentScopeShadow.java:270)
at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:724)
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1549)
at model.content.contentservice_cfc$cf.threadCall(/contentbox/model/content/ContentService.cfc:595)
at railo.runtime.thread.ChildThreadImpl.execute(ChildThreadImpl.java:181)
at railo.runtime.thread.ChildThreadImpl.run(ChildThreadImpl.java:130)

`

So it fails here:

`

/**

  • Update the content hits
  • @contentID.hint The content id to update
    */
    private function syncUpdateHits(required contentID){
    var q = new Query(sql=“UPDATE cb_content SET hits = hits + 1 WHERE contentID = #arguments.contentID#”).execute();
    return this;
    }

`

Two suggestions:

  • I would like to put in a catch block
  • I think this function doesn’t make much sense since it logs all bot access as well. So what about filtering out the bots:

`

// ///////////////////////////////////////////////////////
// this was taken from Mura
// ///////////////////////////////////////////////////////
var userAgent = LCase( CGI.http_user_agent );
//Should we even use sessions?
var trackSession = not (NOT Len( request.userAgent ) OR
REFind( “bot\b”, request.userAgent ) OR
Find( “bot”, request.userAgent ) OR
Find( “crawl”, request.userAgent ) OR
REFind( “\brss”, request.userAgent ) OR
Find( “feed”, request.userAgent ) OR
Find( “news”, request.userAgent ) OR
Find( “blog”, request.userAgent ) OR
Find( “reader”, request.userAgent ) OR
Find( “syndication”, request.userAgent ) OR
Find( “coldfusion”, request.userAgent ) OR
Find( “slurp”, request.userAgent ) OR
Find( “google”, request.userAgent ) OR
Find( “zyborg”, request.userAgent ) OR
Find( “emonitor”, request.userAgent ) OR
Find( “jeeves”, request.userAgent ) OR
Find( “ping”, request.userAgent ) OR
FindNoCase( “java”, request.userAgent ) OR
FindNoCase( “cfschedule”, request.userAgent ) OR
FindNoCase( “reeder”, request.userAgent ) OR
Find( “spider”, request.userAgent ));

if (trackSession)

var q = new Query(sql=“UPDATE cb_content SET hits = hits + 1 WHERE contentID = #arguments.contentID#”).execute();

`

Very interesting. Can you create a ticket for this.