momomoto 0.1.16 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -65,7 +65,11 @@ module Momomoto
65
65
 
66
66
  # executes the stored procedure
67
67
  def call( params = {}, conditions = {}, options = {} )
68
- sql = "SELECT #{columns.keys.join(',')} FROM "
68
+ if columns.length > 0
69
+ sql = "SELECT #{columns.keys.join(',')} FROM "
70
+ else
71
+ sql = "SELECT "
72
+ end
69
73
  sql += "#{full_name}(#{compile_parameter(params)})"
70
74
  sql += compile_where( conditions )
71
75
  sql += compile_order( options[:order] ) if options[:order]
@@ -41,13 +41,15 @@ BEGIN
41
41
  END LOOP;
42
42
  ELSIF typ.typtype = 'p' THEN
43
43
  -- pseudo type
44
- FOR i IN array_lower(proc.proallargtypes, 1) .. array_upper(proc.proallargtypes, 1)
45
- LOOP
46
- CONTINUE WHEN proc.proargmodes[ i ] = 'i';
47
- col.column_name = proc.proargnames[ i ];
48
- col.data_type = format_type( proc.proallargtypes[ i ], NULL );
49
- RETURN NEXT col;
50
- END LOOP;
44
+ IF typ.typname <> 'void' THEN
45
+ FOR i IN array_lower(proc.proallargtypes, 1) .. array_upper(proc.proallargtypes, 1)
46
+ LOOP
47
+ CONTINUE WHEN proc.proargmodes[ i ] = 'i';
48
+ col.column_name = proc.proargnames[ i ];
49
+ col.data_type = format_type( proc.proallargtypes[ i ], NULL );
50
+ RETURN NEXT col;
51
+ END LOOP;
52
+ END IF;
51
53
  ELSE
52
54
  RAISE EXCEPTION 'Not yet implemented';
53
55
  END IF;
@@ -32,6 +32,9 @@ CREATE OR REPLACE FUNCTION test_set_returning( person_id INTEGER ) RETURNS SETOF
32
32
  END;
33
33
  $$ LANGUAGE plpgsql;
34
34
 
35
+ CREATE OR REPLACE FUNCTION test_returns_void() RETURNS VOID AS $$
36
+ $$ LANGUAGE SQL;
37
+
35
38
  CREATE OR REPLACE FUNCTION test_parameter_inout_sql( IN param1 INTEGER, OUT ret1 INTEGER ) AS $$
36
39
  SELECT $1;
37
40
  $$ LANGUAGE sql;
@@ -77,6 +77,12 @@ class TestProcedure < Test::Unit::TestCase
77
77
  Test_set_returning.call({:person_id => 5},{:person_id => 5},{:order=>:person_id,:limit=>10} )
78
78
  end
79
79
 
80
+ def test_returns_void
81
+ self.class.const_set(:Test_returns_void, Class.new( Momomoto::Procedure ) )
82
+ assert_equal( "test_returns_void", Test_returns_void.procedure_name )
83
+ Test_returns_void.call()
84
+ end
85
+
80
86
  def test_call_strict
81
87
  a = Class.new(Momomoto::Procedure)
82
88
  a.procedure_name("test_parameter_sql")
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: momomoto
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.16
7
- date: 2008-01-21 00:00:00 +01:00
6
+ version: 0.1.17
7
+ date: 2008-03-09 00:00:00 +01:00
8
8
  summary: Momomoto is an object relational mapper for PostgreSQL.
9
9
  require_paths:
10
10
  - lib