MYSQLSafe 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +29 -2
- data/lib/MYSQLSafe/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# MYSQLSafe
|
2
2
|
|
3
|
-
|
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
|
-
|
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.
|
data/lib/MYSQLSafe/version.rb
CHANGED