MYSQLSafe
MYSQLSafe abstracts some common MYSQL connection and query actions
Specifically it
- Ensures connection closure
- Returns an Array (instead of MYSQL object)
- Rescues and prints errors
- Sanitizes input
- Encodes queries
- Encloses table and column names in backticks (like
this
.that
)
Installation
Add this line to your application's Gemfile:
gem 'MYSQLSafe'
And then execute:
$ bundle
Or install it yourself as:
$ gem install MYSQLSafe
Usage
MYSQLSafe allows you to optionally set
MYSQLSafe has one other public function which allows you to pass a MYSQL query
safe_sql_connect.connect_safe("SELECT * FROM tablename LIMIT 1;")
And it returns an Array
#=> [["1", "Sam", "Areas Of My Expertise"], ["2", "Caz", "1Q84"], ["3", "Kyle", "How I Became A Famous Novelist"]]
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Contact
Shoot me an email with any questions or ideas.