Ticket #3483 (closed defect: fixed)

Opened 5 years ago

Last modified 4 years ago

Empty name parts stored differently in 3.0 and 3.1

Reported by: tmb Owned by:
Priority: Intend to Milestone: 3.2.4
Component: - Version:
Severity: normal Keywords:
Cc:

Description

3.0 stores empty name parts (eg. lineage, honourific) as "".

3.1 stores empty name parts as NULL.

From 3.0 Database::update around line 910:

if( $multifield->is_type( "name" ) )
{
   $sql .= "\"".prep_value( $v->{v}->{honourific} )."\", ";
   $sql .= "\"".prep_value( $v->{v}->{given} )."\", ";
   ...

In Database::prep_value:

return "" unless( defined $value );

3.1 uses placeholders. From Database::insert, around line 1168:

$sql .= "(".join(",", map { '?' } @$columns).")";
...
my $sth = $self->prepare($sql);
for(@values)
{
  $rc &&= $sth->execute( @$_ );
}

When binding, DBI treats undef values as NULL.  http://search.cpan.org/~timb/DBI-1.607/DBI.pm#Placeholders_and_Bind_Values

Change History

Changed 5 years ago by tdb01r

See r4137.

Changed 4 years ago by tdb01r

  • status changed from new to closed
  • resolution set to fixed

We're now 3.2, name parts are always stored as "".

Note: See TracTickets for help on using tickets.