Functions to return SQL DDL commands that support the
creation and deletion of the cldr_unit database
type and associated aggregate functions.
Summary
Functions
Returns the SQL string which when executed will
define the cldr_unit and cldr_unit_with_usage data types.
Returns the SQL string which when executed will
define aggregate functions for the cldr_unit
and cldr_unit_with_usage data types.
Returns the SQL string which when executed will
drop the aggregate functions for the cldr_unit
and cldr_unit_with_usage data types.
Returns the SQL string which when executed will
drop the cldr_unit and cldr_unit_with_usage data types.
Returns a string that will Ecto execute a single SQL
command.
Returns a string that will Ecto execute each SQL
command.
Functions
Returns the SQL string which when executed will
define the cldr_unit and cldr_unit_with_usage data types.
Arguments
db_typeis the type of the database for which the SQL string should be returned. Defaults to:postgreswhich is currently the only supported database type.
Returns
- A SQL string that can be executed to create the types.
Examples
iex> is_binary(Localize.Unit.DDL.create_cldr_unit())
true
Returns the SQL string which when executed will
define aggregate functions for the cldr_unit
and cldr_unit_with_usage data types.
Arguments
db_typeis the type of the database for which the SQL string should be returned. Defaults to:postgreswhich is currently the only supported database type.
Returns
- A SQL string that can be executed to define the aggregate functions.
Examples
iex> is_binary(Localize.Unit.DDL.define_aggregate_functions())
true
Returns the SQL string which when executed will
drop the aggregate functions for the cldr_unit
and cldr_unit_with_usage data types.
Arguments
db_typeis the type of the database for which the SQL string should be returned. Defaults to:postgreswhich is currently the only supported database type.
Returns
- A SQL string that can be executed to drop the aggregate functions.
Examples
iex> is_binary(Localize.Unit.DDL.drop_aggregate_functions())
true
Returns the SQL string which when executed will
drop the cldr_unit and cldr_unit_with_usage data types.
Arguments
db_typeis the type of the database for which the SQL string should be returned. Defaults to:postgreswhich is currently the only supported database type.
Returns
- A SQL string that can be executed to drop the types.
Examples
iex> is_binary(Localize.Unit.DDL.drop_cldr_unit())
true
Returns a string that will Ecto execute a single SQL
command.
Arguments
sqlis a single SQL command.
Returns
- A string of an Ecto
executestatement.
Examples
iex> Localize.Unit.DDL.execute("SELECT name FROM customers;")
"execute \"SELECT name FROM customers;\""
Returns a string that will Ecto execute each SQL
command.
Arguments
sqlis a string of SQL commands that are separated by three newlines ("\n"), that is to say two blank lines between commands in the file.
Returns
- A string of Ecto
executestatements.
Examples
iex> Localize.Unit.DDL.execute_each("SELECT name FROM customers;\n\n\nSELECT id FROM orders;")
"execute \"SELECT name FROM customers;\"\nexecute \"SELECT id FROM orders;\""