Re: how to set a DEFAULT value !!



On 4/26/06, Greg Sabino Mullane <greg@xxxxxxxxxxxx> wrote:

DBI is complex enough, and AIUI the DBI philosophy opposes adding
features
to the core that will cause implementation headaches for driver authors..

The standard perl idiom for default values is

You misunderstand. The DEFAULT is on the database side, not the client,
and
is represented by sending the literal string 'DEFAULT' to the backend,
similar to the way that null values are sent by the literal string 'NULL'..
The database then populates the column with whatever the default has been
set as, which may be a constant, or may be (in PostgreSQL's case) an
arbitrarily
complex expression or call to a stored procedure.


Is it a string that's sent, or the identifier? For NULL, it is either an
identifier (not quoted) or Perl undef that denotes NULL in the DBMS. I'm
not sure how you'd represent DEFAULT in Perl, or as a string rather than an
identifier.


--
Jonathan Leffler <jonathan.leffler@xxxxxxxxx> #include <disclaimer.h>
Guardian of DBD::Informix - v2005.02 - http://dbi.perl.org
"I don't suffer from insanity - I enjoy every minute of it."


Relevant Pages

  • PostgreSQL and Customer Database
    ... I've been working on both SQL and Perl for a while now, ... get them all onto an SQL database, and be able to keep track of sales, as ... the database available to customers and potential customers, ...
    (perl.beginners)
  • Ways of ensuring integers in the database are seen as numbers in perl?
    ... I'd like my database returned integers to look like integers to Perl but they currently don't until I add 0 to them. ... The reason for this is that adding 0 to a Perl scalar seems to persuade Perl the scalar is an integer. ... $num as returned from database: ...
    (perl.dbi.users)
  • Re: How to access MS Access from Perl?
    ... if you were to later migrate to MS SQL Server or Oracle ... minimize your load on the database server's compiled procedure cache. ... On the other hand, if startup time for your perl script is an issue, and ... slightly preferable to the bulkier DBI + DBD::ODBC. ...
    (comp.lang.perl)
  • Re: Attempted Simultaneous Access causes "Could not lock file"
    ... storing it in my MSAccess database. ... I just wrote another test perl program and pasted in the massive SELECT ... >> I can have multiple perl programs writing to the database, ... > It probably needs exclusive access to the entire Table if it's modifying ...
    (microsoft.public.access.tablesdbdesign)
  • Re: looking at parsing procedures
    ... Wade Ward ... one specifies a literal string with the qand qq ... spend a hundred bucks on the best perl reference. ... provide verification of Keith Thompson's c.l.c. ...
    (comp.lang.c)