-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Some minor notes and corrections. First, hopefully the most important
thing to learn from this thread is to always use placeholders. It just
saves you so much pain and trouble. :)
  
Louis Gonzales asked:
> Two, you didn't actually put ( $1, $2, ... ) , Did you?  In your code,
> that still needs to remain as the question marks.
  
Actually, the $1 form is perfectly acceptable, and even preferable, as it
can be easier to read and handles the case of the same placeholder used more
than once in a statement in a more efficient manner. You can also ue the
":foo" format which is more flexible still. DBD::Oracle and others handle
non-"?" placeholders, although the portability factor is probably not very
important when one is dealing with database functions.


Christian Stalp asks:
> Other question, has anybody experences with PLperl on postgreSQL, thats
> looks facinating. And I think my next function will be reallized in PLperl.
  
Yes, Pl/Perl is amazing. All the power of Perl, directly in your database.
It is so much easier than fighting with the traditional procedural
languages such as pl/sql and pl/pgsql. You can even do things like use
DBI from within your PL/Perl functions. Best of all, you can now write your
triggers in Pl/Perl. How cool is that?


Will Rutherdale said:
> In particular, I'm uncomfortable with forms like 1::numeric, etc., where
> your code contains assumptions about the data types of your columns. If
> you let DBI control it through its knowledge of the schema, then you don't
> have to put those assumptions into your code.  bind_param() takes care
> of that for you, so your code can be more maintainable and portable.
  
Those forms can be very important, as PostgreSQL supports polymorphic
functions, so you *must* tell it what data type you are using if you have
two or more functions with the same name. If you don't, however, and I am
guessing that is the case here, it is usually safe to leave them out.

DBI does not "control through its knowledge of the schema" - it is a pure
abstraction layer, which has no knowledge of any schema (nor should it).
It expects the user to tell it what types through methods such as bind_param.
Alternatively, DBD::Pg has the ability (with some caveats) to pass a
preparable statement to Postgres and let *it* worry about the quoting
when executing.
  
- --
Greg Sabino Mullane [EMAIL PROTECTED]  [EMAIL PROTECTED]
PGP Key: 0x14964AC8 200602232024
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8

-----BEGIN PGP SIGNATURE-----

iD8DBQFD/mLgvJuQZxSWSsgRArY1AKD056Kxb2UJ79UpmiHHpuNp5ZAHxwCeIL2e
uoYzNZKbOsArfRLBAaSeWPo=
=lCYA
-----END PGP SIGNATURE-----


Reply via email to