Query management software? Apr21 '05

I’d appreciate a piece of software that helps manage SQL queries, for development purposes.

Database backend sites are truly query heavy, and over time, it’s easy to forget what each query does.

Comments cause more clutter

Sure, I can write comments above each query, to remind myself – but comments only clutter the distinct brevity of my hard–worked code.

Plus, with comments, it’s too easy to write a book (embellish) about a particular programming statement, only to realize the comments take up more room (or bytes) in your document, than your actual code!

In those situations, I export my comments to another text file, and relatively link to each comment from within the actual document, much like CSS:

# QUERY A

$query = "SELECT row1 FROM table WHERE row1 = 2";

The comment, QUERY A, is a reference to a comment in another text file, where I can embellish all I wish.

Although this is a much cleaner way to handle comments, much more versatility (software) is needed.

A database always changes

As more database columns and tables are added in the future – the complexity of your queries increase. And, since your entire site relies on calls to the database, your site becomes harder to manage, harder to decipher, and harder to implement overall site changes.

I’ve never created a database table, where I didn’t add more fields later on – as new needs and scenarios came up.

And when I add new fields, the structure, relationships, and order of my queries fall out of line. And, when I reference a field from a query result, the array number sometimes changes:

$row = mysql_fetch_array($result);

echo "<a href=\"".$row[4]."\" ... >\n";

Not to mention, I have to re–think all of my table relationships.

The software

I’m looking for software that lets me describe my queries (as much description as I want), and maybe even shows the PHP document that each query is on, the rows affected, etc.

Categories: Efficiency , Software , SQL

Add Feedback (view all)

Leave feedback

Feedback

Input format: The editor controls below will assist with Markdown syntax.

Status

Sub-status

Your info

$row = mysql_fetch_object($result); echo "column_name\" ... >\n"; If you use mysql_fetch_ob ... Read more.

Try it again $row = mysql_fetch_object($result); echo "<a href=\"$row->column_name\" ... >\n"; ... Read more.

With mysql_fetch_array you can just use the column name. For example while($array = mysql_fetch_array($result)) { echo $arr ... Read more.

Timothy, Dale... what happens when you are issuing an INNER JOIN (or equi-join), and you have two columns with the same name? ... Read more.

I suppose you would have to alias the fields that have the same name. I know there are some issues with aliasing and joins in mysql because of the ... Read more.

I have thought about this myself. When I get to about the thousandth line of code it becomes hard to remember which queries I have written already ... Read more.

Timothy, I'm not too familiar with OOP, either (although I should be)... It might help this situat ... Read more.

If you have two of the same name you do this: tablename.columnname so SELECT post.id, comment.id FROM post, comment WHERE post ... Read more.

Dale, will "dot syntax" work when referencing a column via mysql_fetch_array? Using your original comment example: ... Read more.

Yes I think so. ... Read more.

matthom is published and produced by Matt Thommes - an independent publishing enthusiast, mobile blogger, content creator, informative writer, web developer from a suburb of Chicago. Never one to conform, Matt intends to promote the effect the web has on our lives, in an effort to intensify, instruct, and clarify all that is happening around us.

Contact Matt

Popular Pages

  1. Fast rounded corners in Photoshop (5681 recent visits)
  2. PHP – passing variables across pages (2086 recent visits)
  3. JavaScript set selected on load (1741 recent visits)
  4. Removing all child nodes from an element (1210 recent visits)
  5. iPod songs out of order? (1013 recent visits)
  6. Firefox 3 smart address bar: wildcard search (916 recent visits)
  7. Britney - Everytime piano tab (879 recent visits)
  8. MySQL LEFT JOIN syntax (731 recent visits)
  9. Breathe Me - Sia (661 recent visits)
  10. Tumblr: how blogging should be (549 recent visits)

Similar Entries

Stats

1 unique visit since August 2008

Recent Referrers (click)

Syndicate

Advertisements