dmencu 0.8.15 → 0.8.16
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.
- package/install/esquema_comun.sql +24 -0
- package/package.json +1 -1
|
@@ -58,3 +58,27 @@ CREATE OR REPLACE FUNCTION comun.es_par(p_valor anyelement)
|
|
|
58
58
|
AS $BODY$select case when mod(p_valor,2)=0 then TRUE else FALSE end$BODY$
|
|
59
59
|
LANGUAGE 'sql'
|
|
60
60
|
IMMUTABLE ;
|
|
61
|
+
|
|
62
|
+
CREATE OR REPLACE FUNCTION comun.cadena_normalizar(
|
|
63
|
+
p_cadena text)
|
|
64
|
+
RETURNS text
|
|
65
|
+
LANGUAGE 'sql'
|
|
66
|
+
IMMUTABLE
|
|
67
|
+
AS $BODY$
|
|
68
|
+
/*
|
|
69
|
+
-- Pruebas:
|
|
70
|
+
select entrada, esperado, comun.cadena_normalizar(entrada)
|
|
71
|
+
, esperado is distinct from comun.cadena_normalizar(entrada)
|
|
72
|
+
from (
|
|
73
|
+
select 'hola' as entrada, 'HOLA' as esperado
|
|
74
|
+
union select 'Cañuelas', 'CAÑUELAS'
|
|
75
|
+
union select 'ÁCÉNTÍTÓSÚCü','ACENTITOSUCU'
|
|
76
|
+
union select 'CON.SIGNOS/DE-PUNTUACION Y MUCHOS ESPACIOS','CON SIGNOS DE-PUNTUACION Y MUCHOS ESPACIOS'
|
|
77
|
+
union select 'CONÁÀÃÄÂáàãäâ A', 'CONAAAAAAAAAA A'
|
|
78
|
+
union select 'vocalesÁÒöÈÉüÙAeùúÍî?j', 'VOCALESAOOEEUUAEUUII J'
|
|
79
|
+
union select 'ÅåÕõ.e', 'AAOO E'
|
|
80
|
+
) casos
|
|
81
|
+
where esperado is distinct from comun.cadena_normalizar(entrada);
|
|
82
|
+
*/
|
|
83
|
+
select upper(trim(regexp_replace(translate ($1, 'ÁÀÃÄÂÅÉÈËÊÍÌÏÎÓÒÖÔÕÚÙÜÛáàãäâåéèëêíìïîóòöôõúùüûçÇ¿¡!:;,?¿"./,()_^[]*$', 'AAAAAAEEEEIIIIOOOOOUUUUaaaaaaeeeeiiiiooooouuuu '), ' {2,}',' ','g')));
|
|
84
|
+
$BODY$;
|
package/package.json
CHANGED