Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubes
array
Commits
020cc63688f6
Commit
26999e0f
authored
Jul 29, 2013
by
Adrien Di Mascio
Browse files
Rename VALUE to ARRAY_GET, declare rql to sql mapping directly in FunctionDescr (closes #3036180)
parent
4cb35994be73
Changes
2
Hide whitespace changes
Inline
Side-by-side
schema/_regroc.postgres.sql
deleted
100644 → 0
View file @
4cb35994
/* -*- sql -*-
postgres specific registered procedures,
require the plpgsql language installed
add the VALUE function to be able to query the postgres arrays
in RQL query, example below:
Any X WHERE X is TimeSerie, X serie S HAVING VALUE(S, 10)>3
*/
CREATE
OR
REPLACE
FUNCTION
VALUE
(
ar1
integer
[],
indice
integer
)
RETURNS
float
AS
$$
BEGIN
return
ar1
[
indice
];
END
;
$$
LANGUAGE
plpgsql
;
\ No newline at end of file
site_cubicweb.py
View file @
020cc636
...
...
@@ -40,11 +40,14 @@ sqlitehelper.TYPE_CONVERTERS['FloatArray'] = json.dumps
from
rql.utils
import
register_function
class
VALUE
(
FunctionDescr
):
class
ARRAY_GET
(
FunctionDescr
):
minargs
=
2
maxargs
=
2
supported_backends
=
(
'postgres'
,)
rtype
=
'Float'
def
as_sql_postgres
(
self
,
args
):
return
"%s[%s]"
%
(
args
[
0
],
args
[
1
])
register_function
(
VALUE
)
register_function
(
ARRAY_GET
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment