1
votes

When I call EntityLoad does it load ALL the data in the table or just sets up a reference or something, because say if i do this:

<cfset test = EntityLoad("Table") />

and then do:

ArrayLen(test)

I get the number of rows in the database. If its doing that then it should be loading all the data, and that is really inefficent, say I have a table with 20x10^5 rows or something, it'll be horrible to load all data just to get the length of the table.

2
do this = what? pls CODE your code with Ctrl+K. - Henry

2 Answers

2
votes

Without seeing your code, I don't know exactly what you're talking about, but here's the run-down:

EntityLoad w/ 1 argument (the Entity name) is going to load all the Entities with that name from the DB. It does however take some additional (optional) arguments to adjust it's behavior. Instead of describing all of them here I'll point you to the beta documentation and a site giving some further exmaples:

1
votes

To do what you are trying to do efficiently without incurring a select * on your table, use HQL.

<cfset hqlQuery = "select count(*) From person" />

<cfset results = ORMExecuteQuery(hqlQuery)[1] />