How can this be rewritten using the new scripting syntax along with the hibernate query language in CF9?
<cfcomponent output="no">
<cffunction name="Login" output="no">
<cfargument name="UsrName">
<cfargument name="UsrPassword">
<cfquery name="local.qry">
SELECT * FROM UsrView
WHERE UsrName = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.UsrName#">
AND UsrPassword = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.UsrPassword#">
</cfquery>
<cfreturn local.qry>
</cffunction>
</cfcomponent>
Is this what you are after?
component{
public query function Login(UsrName,UsrPassword){
// get array of entities matching filter
var arrayOfUsers = EntityLoad('User',{
UsrName=arguments.UsrName, UsrPassword=arguments.UsrPassword
});
// convert entity array to a query object
return EntitytoQuery(arrayOfUsers);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.