Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Mixing Perl and SQL

by mje (Curate)
on Nov 04, 2009 at 17:11 UTC ( #804994=note: print w/replies, xml ) Need Help??

in reply to Mixing Perl and SQL

This does not strictly answer your question but it works well for us and you might find it useful. The ONLY SQL we have in our application is:

begin synonym.proc_name(?, ? ....); end; begin ? := synonym.func_name(?, ?, ...); end;

All the SQL is in procedures and functions in the database - including those that simply return a result-set. This allows us to keep all the logic in the database. Of course you can only do this if your DBD and database supports procedures and the returning of reference cursors which DBD::Oracle and Oracle does.

Replies are listed 'Best First'.
Re^2: Mixing Perl and SQL
by toma (Vicar) on Nov 04, 2009 at 21:04 UTC
    My code has to create the whole database from scratch, so I would need to include the SQL code that creates the stored procedures, and therefore I think I would be left with the same mixed-language issue.

    For example, one of my programs first uses modules to transform the input data from several formats into flat files. Then it uses modules that include the SQL to:

    1. Create an empty database with tables and views.
    2. Load the data from flat files.
    3. Transform the data into another set of tables that use a different indexing scheme.
    4. Query the data to generate a report.

    It should work perfectly the first time! - toma

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://804994]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2018-01-18 07:04 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (206 votes). Check out past polls.