Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: DBI - Table names & placeholders

by Anonymous Monk
on Dec 03, 2012 at 16:40 UTC ( [id://1006910]=note: print w/replies, xml ) Need Help??


in reply to Re^2: DBI - Table names & placeholders
in thread DBI - Table names & placeholders

I solved this problem when I had to deal a few dozen tables all with the same format and function each named by a client number determined from input data. The trick is to use a synonym. Write code for one table using a false table name. Then create a synonym named with your false name. Then alter the synonym to point to the table you need to use when you need to and reuse the bulk of your code. If the term 'synonym' is not familiar, consider it an alias or a symbolyc link with its own name that represents another object (table?) that may have another name. I don't know the performance impact of this method but I suspect altering a synonym is pretty cheap next to recompiling your insert statements. Hope this helps.

Replies are listed 'Best First'.
Re^4: DBI - Table names & placeholders
by erix (Prior) on Dec 03, 2012 at 17:19 UTC

    Alas, neither MySQL nor PostgreSQL (the 2 systems the OP mentions) support CREATE SYNONYM.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1006910]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-05-18 04:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found