fluiddb 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/FluidDb/Pgsql.rb +71 -71
  2. metadata +1 -1
data/lib/FluidDb/Pgsql.rb CHANGED
@@ -20,86 +20,86 @@ module FluidDb
20
20
 
21
21
  return hash
22
22
  end
23
+
24
+ def queryForArray( sql, params )
25
+ sql = self.format_to_sql( sql, params )
26
+ results = @connection.exec(sql)
23
27
 
24
- def queryForArray( sql, params )
25
- sql = self.format_to_sql( sql, params )
26
- results = @connection.exec(sql)
27
-
28
- # if ( $result === false ) then
29
- # $message = pg_last_error( $this->connection );
30
- # throw new Fluid_ConnectionException( $message );
31
- #end
32
-
33
- case results.num_tuples
34
- when -1
35
- raise FluidDb::ConnectionError.new
36
- when 0
37
- raise FluidDb::NoDataFoundError.new
38
- when 1
39
- return self.convertTupleToHash(results.fields, results, 0)
40
- else
41
- raise FluidDb::TooManyRowsError.new
42
- end
43
- end
28
+ # if ( $result === false ) then
29
+ # $message = pg_last_error( $this->connection );
30
+ # throw new Fluid_ConnectionException( $message );
31
+ #end
44
32
 
45
- def queryForValue( sql, params )
46
- sql = self.format_to_sql( sql, params )
47
- results = @connection.query(sql, :as => :array)
48
-
49
- # if ( $result === false ) then
50
- # $message = pg_last_error( $this->connection );
51
- # throw new Fluid_ConnectionException( $message );
52
- #end
53
-
54
- case results.num_tuples
55
- when -1
56
- raise FluidDb::ConnectionError.new
57
- when 0
58
- raise FluidDb::NoDataFoundError.new
59
- when 1
60
- return results.getvalue(0,0)
61
- else
62
- raise FluidDb::TooManyRowsError.new
63
- end
64
-
33
+ case results.num_tuples
34
+ when -1
35
+ raise FluidDb::ConnectionError.new
36
+ when 0
37
+ raise FluidDb::NoDataFoundError.new
38
+ when 1
39
+ return self.convertTupleToHash(results.fields, results, 0)
40
+ else
41
+ raise FluidDb::TooManyRowsError.new
65
42
  end
43
+ end
44
+
45
+ def queryForValue( sql, params )
46
+ sql = self.format_to_sql( sql, params )
47
+ results = @connection.exec(sql)
48
+
49
+ # if ( $result === false ) then
50
+ # $message = pg_last_error( $this->connection );
51
+ # throw new Fluid_ConnectionException( $message );
52
+ #end
66
53
 
67
-
68
- def queryForResultset( sql, params )
69
- sql = self.format_to_sql( sql, params )
70
- results = @connection.query(sql)
71
-
72
- # if ( $result === false ) then
73
- # $message = pg_last_error( $this->connection );
74
- # throw new Fluid_ConnectionException( $message );
75
- #end
76
-
77
- case results.num_tuples
78
- when -1
79
- raise FluidDb::ConnectionError.new
80
- else
81
- list = Array.new
82
- fields = results.fields
83
- 0.upto( results.num_tuples -1 ) do |nbr|
84
- list.push self.convertTupleToHash(fields, results, nbr)
85
- end
86
-
87
- return list
88
- end
54
+ case results.num_tuples
55
+ when -1
56
+ raise FluidDb::ConnectionError.new
57
+ when 0
58
+ raise FluidDb::NoDataFoundError.new
59
+ when 1
60
+ return results.getvalue(0,0)
61
+ else
62
+ raise FluidDb::TooManyRowsError.new
89
63
  end
90
64
 
65
+ end
66
+
67
+
68
+ def queryForResultset( sql, params )
69
+ sql = self.format_to_sql( sql, params )
70
+ results = @connection.exec(sql)
91
71
 
92
- # def execute( sql, params, expected_affected_rows )
93
- def execute( sql, params )
94
- sql = self.format_to_sql( sql, params )
95
- @connection.query( sql );
96
- end
72
+ # if ( $result === false ) then
73
+ # $message = pg_last_error( $this->connection );
74
+ # throw new Fluid_ConnectionException( $message );
75
+ #end
97
76
 
98
- def insert( sql, params )
99
- self.execute( sql, params )
100
- return @connection.last_id
77
+ case results.num_tuples
78
+ when -1
79
+ raise FluidDb::ConnectionError.new
80
+ else
81
+ list = Array.new
82
+ fields = results.fields
83
+ 0.upto( results.ntuples() -1 ) do |nbr|
84
+ list.push self.convertTupleToHash(fields, results, nbr)
85
+ end
86
+
87
+ return list
101
88
  end
102
-
89
+ end
90
+
91
+
92
+ # def execute( sql, params, expected_affected_rows )
93
+ def execute( sql, params )
94
+ sql = self.format_to_sql( sql, params )
95
+ @connection.query( sql );
96
+ end
97
+
98
+ def insert( sql, params )
99
+ self.execute( sql, params )
100
+ return @connection.last_id
103
101
  end
104
102
 
105
103
  end
104
+
105
+ end
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.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: