Skip to content

Instantly share code, notes, and snippets.

@fgaray
Created May 13, 2014 00:23
Show Gist options
  • Save fgaray/714488e993d4a7c7cede to your computer and use it in GitHub Desktop.
Save fgaray/714488e993d4a7c7cede to your computer and use it in GitHub Desktop.
CREATE OR REPLACE FUNCTION sp_crear_participante(nombre TEXT, clave TEXT)
RETURNS TEXT
AS
$$
import json
from hashlib import md5
m = md5()
m.update(clave)
claveEncriptada = m.hexdigest()
plan = plpy.prepare("INSERT INTO participante (nombre, clave) VALUES ($1, $2)", ["text", "text"])
plpy.execute(plan, [nombre, claveEncriptada])
return json.dumps(True)
$$
LANGUAGE 'plpython2u';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment