ezSQL, Django and others discussion

1 replies
This is a thread offshoot from the one I created about FOREACH Loops. An off topic discussion started so I am creating this new thread to continue those.

Here is the preliminary discussion starter I am pasting from Steve Johnson from that other thread.


Originally Posted by SteveJohnson View Post

The function mysql_query returns a resource - not the actual data. You must use the 'fetch' functions to retrieve the individual rows.

The 'foreach' construct is merely a way to iterate through arrays or objects, and is a way of combining 'list' and 'each' for working with arrays.

I would highly recommend using an addon class like ezSQL ( available at Justin Vincent , or used to be ) to work with databases. It makes programming life so much easier. As a matter of fact, ezSQL is what the WordPress database functions are derived from.



Response:

Yeah Steve, I took a look at that ezSQL and read through the introduction page... The only thing I see for me of value there is the caching feature.

I actually created a couple functions that handle most the mysql calls I need, I just need to call them and choose what sort of output I want and it just takes care of it for me.

In cases where I need more specific results I created a function that all I need to do is pass a properly formatted SQL Query and it parses the data, sanitizes the data and returns it in various formats or data sets via a toggle I pass to the function.

It might of been easier to use something like this ezSQL to build this but I got it now and it works great and I just have one line to embed in any page to get whatever data I need.

Looking through the introduction page in that ezSQL my calls are actually smaller than the ones they have in their samples. Only thing I don't have that they do is caching. Maybe I will just convert some of these dynamically created pages into static pages that way no need for database caching.. LOL

Thanks,

- T
#discussion #django #ezsql
  • Profile picture of the author SteveJohnson
    If you have the time to create your own specialized solutions, you're almost always better off in terms of coding efficiency. Some of the popular classes, like ezSQL, get bloated by adding features that not everyone needs or will use.
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[5049698].message }}

Trending Topics