Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simple ruby helper for generating portable SQL expressions.
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
rails
.gitignore
MIT-LICENSE
README.markdown
port-a-query.gemspec

README.markdown

Port-a-Query Still Maintained?

One of the things that sucks about SQL is that every databse has a different implementation of SQL.

Port-a-Query is designed to make writing portable SQL queries a bit easier by providing simple helper methods that product the right SQL for your environment.

This project is just something I work on as I need it and it's not meant to be a comprehensize solution. If there's something you'd like added just put in a feature request or send me a patch.

Example

In port-a-query symbols are treated as identifiers (table names, column names, etc.). Strings will be treated as literal strings.

For example the following code

PortAQuery.concat(:first_name, ' ', :last_name)

will produce the following SQL.

MySQL "first_name"||' '||"last_name"

SQLite CONCAT(first_name,' ',last_name)

Tips

  • Port-a-Query is a Ruby on Rails specific gem that uses the database adapter defined by the current environment. There is no method for manually changing the adapter at the moment.

Supported Databases

Supported Expressions

PortAQuery.concat()
PortAQuery.quote_string()
PortAQuery.quote_identifier()

Copyright (c) 2010 Adam Crownoble, released under the MIT license

Something went wrong with that request. Please try again.