Skip to content

Instantly share code, notes, and snippets.

@robertz
Last active August 29, 2015 14:04
Show Gist options
  • Save robertz/fcfda780077e63068078 to your computer and use it in GitHub Desktop.
Save robertz/fcfda780077e63068078 to your computer and use it in GitHub Desktop.
public function get(string objectid = '') {
var queryUser = new query();
var hasParams = len(arguments.objectid) && isNumeric(arguments.objectid);
var sql = 'select objectID, username, password, bAdmin, ratingLimit from user';
if(hasParams){
sql = sql & ' where objectid = :objectid';
}
queryUser.setSQL(sql);
if(hasParams){
queryUser.addParam(name="objectid",value="1",cfsqltype="INT");
}
return application.utils.queryToArray( queryUser.execute().getResult() );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment