Skip to content
This repository

Simple ruby helper for generating portable SQL expressions.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 rails
Octocat-spinner-32 .gitignore
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.markdown
Octocat-spinner-32 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.