Re: how to set a DEFAULT value !!




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


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.

DBI (or DBD) currently maps undef to the literal string NULL before sending it
to the backend. To achieve other values, we have to use something besides a
simple scalar. In DBD::Pg's case, we're using a blessed ref, so the backend
does something like this:

if (! defined $value) {
$value = "NULL";
}
elsif (ref $value eq 'DBD::Pg::DefaultValue') {
$value = "DEFAULT";
}
else {
$value = quote($value);
}

The user would do something like this:

$sth->execute(12,undef,'chocolate',$DBDPG_DEFAULT,99);

Ideally once it's added to DBI the code becomes a little more portable:

$sth->execute(12,undef,'chocolate',$DBI_DEFAULT,99);

I'm working on expanding this into a more general framework, as there are
some other "magic" variables that could also be usefully sent, such as
CURRENT_TIMESTAMP.

- --
Greg Sabino Mullane greg@xxxxxxxxxxxx
PGP Key: 0x14964AC8 200604271801
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iD8DBQFEUUAZvJuQZxSWSsgRAku7AJ4oios4B4DeHNFry+VwFnd5z6NGMgCfTPsS
NEqjDqwKEyyWubisf4PEwKQ=
=FLUs
-----END PGP SIGNATURE-----


.



Relevant Pages

  • Double Linked List Help
    ... 256 characters long identified in the input file F. Each identifier ... identifier, length is an integer representing the length of the ... string is a string of characters representing the identifier itself. ...
    (comp.lang.c.moderated)
  • Re: kde4 and opengl
    ... server glx vendor string: NVIDIA Corporation ... Identifier "Simple Layout" ...
    (comp.windows.x.kde)
  • Re: Countif in VB Script
    ... identifies/keeps track of its patients. ... However, they use a wrist band identifier, which is usually not subject ... The collection keeps track what it has stored by using a unique string ... colvalues.add vbNullString, CStr.value) ...
    (microsoft.public.excel.programming)
  • IDispatchEx functionality for COM interoperable .NET objects
    ... >> var mystring = child.xml ... > except that, using a string rather than an identifier, the latter syntax ... > need to code Invoke to recognize these special DISPIDs and redirect to a ...
    (microsoft.public.dotnet.framework.interop)
  • Re: COM Collections/arrays accessed from JScript
    ... >> var mystring = child.xml ... > except that, using a string rather than an identifier, the latter syntax ... > need to code Invoke to recognize these special DISPIDs and redirect to a ...
    (microsoft.public.win32.programmer.ole)