Welcome Guest, Not a member yet? Register   Sign In
count_all_results returns a string?
#6

[eluser]fritzthecat[/eluser]
Hi, thanks for the comprehensive reply.

Yes I accept that mySql returns strings in a few places where you don't expect it to, but I still think CI should make its own decision on the matter. Otherwise if you change db driver to, say, MS-SQL and that returns and integer, your code may break. I'd prefer if CI was consistent across drivers, and if some behave oddly then correct them.

As a thought experiment, imagine the scenario where you cache a query and then use a custom extension similar to count_all_results on the cached version - presumably you'd do that by counting the cached rows in an array. Would you then cast that count to a string, to replicate mySql's illogical behaviuour? It'd be strange.

As for coders' expectations, when coding directly in mySql I am fully aware count returns and a string, but when using count_all_results I was in 'CI' mode, and my first instinct was to expect it to return an integer. They are two different contexts, I don't think there'd be any confusion if they behaved differently.

Anyway, that's just my two cents, and it's not that important after all.


Messages In This Thread
count_all_results returns a string? - by El Forum - 04-03-2009, 08:51 AM
count_all_results returns a string? - by El Forum - 04-03-2009, 08:54 AM
count_all_results returns a string? - by El Forum - 04-03-2009, 09:03 AM
count_all_results returns a string? - by El Forum - 04-03-2009, 09:45 AM
count_all_results returns a string? - by El Forum - 04-03-2009, 10:49 AM
count_all_results returns a string? - by El Forum - 04-03-2009, 01:25 PM
count_all_results returns a string? - by El Forum - 04-03-2009, 01:54 PM
count_all_results returns a string? - by El Forum - 04-04-2009, 09:57 AM
count_all_results returns a string? - by El Forum - 04-05-2009, 04:09 AM
count_all_results returns a string? - by El Forum - 04-05-2009, 04:30 AM
count_all_results returns a string? - by El Forum - 04-05-2009, 04:56 AM
count_all_results returns a string? - by El Forum - 04-05-2009, 06:06 AM
count_all_results returns a string? - by El Forum - 04-08-2009, 10:50 AM
count_all_results returns a string? - by El Forum - 04-08-2009, 11:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB