fluiddb 0.0.24 → 0.0.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/FluidDb/TinyTds.rb +6 -3
  2. data/lib/FluidDb.rb +5 -1
  3. metadata +2 -2
@@ -16,7 +16,7 @@ module FluidDb
16
16
  database = uri.path.sub( "/", "" )
17
17
  username = URI.unescape( uri.user )
18
18
  password = uri.password
19
-
19
+
20
20
 
21
21
  if dataserver == "" ||
22
22
  database == "" then
@@ -42,6 +42,10 @@ module FluidDb
42
42
  @connection.close
43
43
  end
44
44
 
45
+ def escape_string( input )
46
+ return @connection.escape( input )
47
+ end
48
+
45
49
  def queryForArray( sql, params )
46
50
  sql = self.format_to_sql( sql, params )
47
51
  results = @connection.execute(sql)
@@ -77,8 +81,7 @@ module FluidDb
77
81
 
78
82
  return value
79
83
  end
80
-
81
-
84
+
82
85
  def queryForResultset( sql, params )
83
86
  sql = self.format_to_sql( sql, params )
84
87
  results = @connection.execute(sql)
data/lib/FluidDb.rb CHANGED
@@ -57,6 +57,10 @@ module FluidDb
57
57
  return sql_out
58
58
  end
59
59
 
60
+ def escape_string( input )
61
+ return input.split( "'" ).join( "''" )
62
+ end
63
+
60
64
  def format_to_sql( sql, params=nil )
61
65
  if params.nil? || params.count == 0 then
62
66
  return sql
@@ -64,7 +68,7 @@ module FluidDb
64
68
 
65
69
  params.each_with_index do |v, idx|
66
70
  if v.kind_of? String then
67
- v = "'" + v.split( "'" ).join( "''" ) + "'"
71
+ v = "'" + self.escape_string( v ) + "'"
68
72
  # v = "'" + v.sub( "'", "\'" ) + "'"
69
73
  elsif v.is_a? DateTime then
70
74
  v = "'" + v.strftime( "%Y-%m-%d %H:%M:%S" ) + "'"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluiddb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.24
4
+ version: 0.0.25
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-03 00:00:00.000000000 Z
12
+ date: 2013-04-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A semantic layer for db interaction
15
15
  email: guy@guyirvine.com