Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

SELECT in procedures #1

Open
wols opened this Issue Feb 13, 2012 · 1 comment

Comments

Projects
None yet
2 participants

wols commented Feb 13, 2012

-----8<-----8<-----

--[ create_procedure_ploginfo ]

CREATE PROCEDURE PLogInfo (
in_message VARCHAR(1024),
in_keyvalue VARCHAR(32)
)

MAIN_BLOCK:BEGIN

DECLARE loc_threshold INT DEFAULT 0;
SELECT threshold
FROM TLogLevel
WHERE keyvalue = in_keyvalue
INTO loc_threshold;
CALL PLogLvl(in_message,in_keyvalue,4,loc_threshold);

END MAIN_BLOCK

--[]

-----8<-----8<-----

...with SELECT statement in MAIN_BLOCK:

-----8<-----8<-----

Constructing Bibliosoph
Prepared 1 Statements
Created methods for [1] queries
many create_procedure_ploginfo
DBD::mysql::st fetchall_arrayref failed: fetch() without execute() at
/usr/lib/perl5/vendor_perl/5.14.2/SQL/Bibliosoph/Query.pm line 64.
DBD::mysql::st fetchall_arrayref failed: fetch() without execute() at
/usr/lib/perl5/vendor_perl/5.14.2/SQL/Bibliosoph/Query.pm line 64.

-----8<-----8<-----

...without SELECT statement in MAIN_BLOCK:

-----8<-----8<-----

Constructing Bibliosoph
Prepared 1 Statements
Created methods for [1] queries
oth create_procedure_ploginfo

-----8<-----8<-----

Here differs 'many' and 'oth'.
'create_procedure_ploginfo' should not be a '^SELECT ' statement for
your 'create_method_for' in Bibliosoph.pm.

Is here not a type 'CREATE' in 'create_methods_from' missing? All behind
'CREATE (FUNCTION|PROCEDURE)' could be mask for execute.

Owner

matiu commented Feb 14, 2012

Here is a workaround:

For our websites (cinefis.com.ar, cinemaki.com.br, *) we have a file (procedures.sql) were all the procedures and functions definitions are. Those definitions are not in the bibliosoph file (.bb) since they only need to be executed once, and the definition persist on the DB.

I think It wont be necessary to support CREATE PROCEDURE from bibliosoph.

From Bibliosoph you can later call the procedures:

--[ MY_PROC ]
-- Inputs: name, id
CALL my_proc(?, ?)

OR

--[ MY_PROC_WITH_RESULTSET ]
/* SELECT */ CALL my_resultset(?,?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment