<cfsetting showdebugoutput="false">
<cfsetting enablecfoutputonly="true">
<cfcontent type="application/json; charset=utf-8" reset="true">

<cfscript>
// Check Big Dean's owner
q = queryExecute("
  SELECT b.BusinessID, b.BusinessName, b.BusinessUserID
  FROM Businesses b
  WHERE b.BusinessID = 27
", {}, { datasource: "payfrit" });

// Get users
users = queryExecute("
  SELECT *
  FROM Users
  ORDER BY UserID
  LIMIT 20
", {}, { datasource: "payfrit" });

colNames = users.getColumnNames();

writeOutput(serializeJSON({
  "OK": true,
  "BigDeans": {
    "BusinessID": q.BusinessID,
    "BusinessName": q.BusinessName,
    "BusinessUserID": q.BusinessUserID
  },
  "UserColumns": colNames,
  "UserCount": users.recordCount
}));
</cfscript>
