Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save settermjd/c96d89a271090fd00af5 to your computer and use it in GitHub Desktop.
Save settermjd/c96d89a271090fd00af5 to your computer and use it in GitHub Desktop.
Powerful, Flexible, Maintainable SQL Generation - Without The Hassle

PHP is almost synonymous with databases, and has been since the early versions. Yet creating SQL queries can still be a challenging task. What's the right tool to use? ORMs often feel like overkill. And creating queries by hand can be unmaintainable. In this session, I'll show you how to use the Zend\Db library to generate SQL queries; from simple selects, through to more complex unions, filtered deletions, and updates. You'll learn how to use the library to create flexible, secure, maintainable, and reusable queries quickly, and efficiently, saving you time and effort in the long term.

@omerida
Copy link

omerida commented Jun 5, 2015

I'd rephrase "Without the FAt" as just "Lean"

@omerida
Copy link

omerida commented Jun 5, 2015

to open this to a general audience, I would pitch that you'll show show how to build a query with raw SQL + PDO and then show how Zend\Db can build the same query just easier to read and maintain.

@settermjd
Copy link
Author

Thanks @omerida. I was trying to go for a catchy title with that original title, and was trying to get a pick of the George Forman grill in there. I've updated it to appeal to more needs the user may have.

@settermjd
Copy link
Author

My intent is to build a range of queries, growing in complexity, starting from a simple one, such as a select * from blah where ..., then building up to a multi-union query, via simple refactoring. However, I'm not sure if my ambition is too big for the time available.

@e3betht
Copy link

e3betht commented Jun 5, 2015

I don't think you need the first half of the first sentence. Is this talk just focused on MySQL? If not, don't mention that. Instead of saying "Doctrine" perhaps mention ORM's instead to make it more general (unless you are specifically talking about Doctrine in your talk?).

You do discuss some benefits of Zend/Db, but you need to more clearly define what is the benefit that attendees will gain or the solution they will receive to their problem?

@settermjd
Copy link
Author

Thanks Beth. I'll see what I can do.

@lornajane
Copy link

Key to a talk like this (as I've given several bad ones) is clearly framing the problem each query solves (is it a date range? Those are tricky! How about the classic "get the newest revision" problem) rather than the technique in use to solve it. Also beware that you probably want to show off some stuff that some of the audience isn't totally familiar with in SQL, loads of web developers don't really understand multiple joins or aggregate queries, so be prepared to do a quick refresh on the SQL first at each step.

@settermjd
Copy link
Author

I get you. Thanks for the tip mate. I especially like your point about covering some areas that the audience isn't especially familiar with. I'll rework it further and add some notes to take those points in to consideration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment