Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Postgres/src/pl/plpython/sql/   (The Python Language ©)  Datei vom 11.4.2026 mit Größe 917 B image not shown  

SSL plpython_import.sql

  Sprache: SQL
 

-- import python modules

CREATE FUNCTION import_fail() returns text
    AS
'try:
 import foosocket
except ImportError:
 return "failed as expected"
return "succeeded, that wasn''t supposed to happen"'
    LANGUAGE plpython3u;


CREATE FUNCTION import_succeed() returns text
 AS
'try:
  import array
  import bisect
  import calendar
  import cmath
  import errno
  import math
  import operator
  import random
  import re
  import string
  import time
except Exception as ex:
 plpy.notice("import failed -- %s" % str(ex))
 return "failed, that wasn''t supposed to happen"
return "succeeded, as expected"'
    LANGUAGE plpython3u;

CREATE FUNCTION import_test_one(p text) RETURNS text
 AS
'try:
    import hashlib
    digest = hashlib.sha1(p.encode("ascii"))
except ImportError:
    import sha
    digest = sha.new(p)
return digest.hexdigest()'
 LANGUAGE plpython3u;

CREATE FUNCTION import_test_two(u users) RETURNS text
 AS
'plain = u["fname"] + u["lname"]
try:
    import hashlib
    digest = hashlib.sha1(plain.encode("ascii"))
except ImportError:
    import sha
    digest = sha.new(plain);
return "sha hash of " + plain + " is " + digest.hexdigest()'
 LANGUAGE plpython3u;


-- import python modules
--
SELECT import_fail();
SELECT import_succeed();

-- test import and simple argument handling
--
SELECT import_test_one('sha hash of this string');

-- test import and tuple argument handling
--
select import_test_two(users) from users where fname = 'willem';

Messung V0.5 in Prozent
C=91 H=96 G=93

¤ Dauer der Verarbeitung: 0.17 Sekunden  (vorverarbeitet am  2026-08-08) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.