The database API does a lookup to resolve the query identified by "select_folder_contents_count" based on what database you have chosen.
Take a look at the .XQL files that will have the same name as the file-storage tcl file being executed. You'll see your query there.
I've found using emacs' tags function to bounce between code and SQL pretty helpful.