Module: PgSaurus::ConnectionAdapters::AbstractAdapter::FunctionMethods
- Included in:
- PgSaurus::ConnectionAdapters::AbstractAdapter
- Defined in:
- lib/pg_saurus/connection_adapters/abstract_adapter/function_methods.rb
Overview
Adapter definitions for DB functions.
Instance Method Summary collapse
-
#create_function(function_name, returning, definition, options = {}) ⇒ Object
Create a database function.
-
#drop_function(function_name, options) ⇒ Object
Delete the database function.
-
#functions ⇒ Object
Return the listing of currently defined DB functions.
-
#supports_functions? ⇒ Boolean
:nodoc.
Instance Method Details
#create_function(function_name, returning, definition, options = {}) ⇒ Object
Create a database function.
Example:
# Arguments are: function_name, return_type, function_definition, options (currently, only :schema)
create_function 'pets_not_empty()', :boolean, <<-FUNCTION, schema: 'public'
BEGIN
IF (SELECT COUNT(*) FROM pets) > 0
THEN
RETURN true;
ELSE
RETURN false;
END IF;
END;
FUNCTION
The schema is optional.
26 27 28 |
# File 'lib/pg_saurus/connection_adapters/abstract_adapter/function_methods.rb', line 26 def create_function(function_name, returning, definition, = {}) end |
#drop_function(function_name, options) ⇒ Object
Delete the database function.
Example:
drop_function 'pets_not_empty()', schema: 'public'
The schema is optional.
37 38 39 |
# File 'lib/pg_saurus/connection_adapters/abstract_adapter/function_methods.rb', line 37 def drop_function(function_name, ) end |
#functions ⇒ Object
Return the listing of currently defined DB functions.
42 43 44 |
# File 'lib/pg_saurus/connection_adapters/abstract_adapter/function_methods.rb', line 42 def functions end |
#supports_functions? ⇒ Boolean
:nodoc
5 6 7 |
# File 'lib/pg_saurus/connection_adapters/abstract_adapter/function_methods.rb', line 5 def supports_functions? false end |