MYSQLSafe 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +29 -2
  2. data/lib/MYSQLSafe/version.rb +1 -1
  3. metadata +1 -1
data/README.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # MYSQLSafe
2
2
 
3
- TODO: Write a gem description
3
+ MYSQLSafe abstracts some common MYSQL connection and query actions
4
+ Specifically it
5
+ + Ensures connection closure
6
+ + Returns an Array (instead of MYSQL object)
7
+ + Rescues and prints errors
8
+ + Sanitizes input
9
+ + Encodes queries
10
+ + Encloses table and column names in backticks (like `this`.`that`)
4
11
 
5
12
  ## Installation
6
13
 
@@ -18,7 +25,23 @@ Or install it yourself as:
18
25
 
19
26
  ## Usage
20
27
 
21
- TODO: Write usage instructions here
28
+ MYSQLSafe allows you to optionally set
29
+ + host
30
+ + database
31
+ + user
32
+ + password
33
+ + encoding
34
+
35
+ safe_sql_connect = MYSQLSafe::Base.new()
36
+ safe_sql_connect.user = 'username'
37
+ safe_sql_connect.host = 'myhost'
38
+ safe_sql_connect.password = ENV['MYSQLPASSWORD']
39
+ safe_sql_connect.database = 'databasename'
40
+ safe_sql_connect.encoding = 'iso-8859-1' # otherwise defaults to utf-8
41
+
42
+ MYSQLSafe has one other public function which allows you to pass a MYSQL query
43
+
44
+ safe_sql_connect.connect_safe("SELECT * FROM tablename LIMIT 1;")
22
45
 
23
46
  ## Contributing
24
47
 
@@ -27,3 +50,7 @@ TODO: Write usage instructions here
27
50
  3. Commit your changes (`git commit -am 'Add some feature'`)
28
51
  4. Push to the branch (`git push origin my-new-feature`)
29
52
  5. Create new Pull Request
53
+
54
+ ## Contact
55
+
56
+ Shoot me [an email](mailto:scnissen@gmail.com) with any questions or ideas.
@@ -1,3 +1,3 @@
1
1
  module MYSQLSafe
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: MYSQLSafe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: