Michael A Chase wrote:

If you can give us a pertinent snippet of the program that has the problem and some sample data including rows that do and don't show the problem, it might be easier for someone here to guess what's happening.


The strange thing is that the bug seems to depend on the number and ordering of the rows. It also depends on what data is in the records. Reordering will sometimes (not always) change which rows have a column truncated. Reducing the rows to just the problem ones causes them to not be truncated. I tried adding data to all the columns to get a better idea of what was being truncated, and that caused nothing to be truncated.


The code looks like this:

my $sql = <<'END_HERE';
INSERT INTO excelDroppings (
uploadID, ownerID, category, color, dealer_cost, description,
manuf_model, image_name_sm, image_name_lg, manufacturer, model,
product_id, retail_price, size, status, saleprice, [delete] )
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
END_HERE

my $sth = $dbh->prepare($sql);
foreach my $product (@_)
{
    my @args = @$product{qw(
category color dealer_cost description manuf_model image_name_sm
image_name_lg manufacturer model product_id retail_price size status
saleprice delete)};
    $sth->execute($uploadID, $ownerID, @args);
}

The problem records are:

          {
            'saleprice' => '0.00',
            'category' => 'Fly Tying Tools',
            'description' => '',
            'manuf_model' => 'Wasatch Custom Tools',
            'product_id' => '1100-6834',
            'status' => 1,
            'dealer_cost' => 0,
            'image_name_lg' => '',
            'retail_price' => '11.95',
            'manufacturer' => 'Fly Tying Tools',
            'size' => '',
            'image_name_sm' => 'W3009.jpg',
            'model' => 'Hair Stacker Micro',
            'color' => 'Cocobolo'
          },
          {
            'saleprice' => '0.00',
            'category' => 'Fly Tying Tools',
            'description' => '',
            'manuf_model' => 'Wasatch Custom Tools',
            'product_id' => '1100-6839',
            'status' => 1,
            'dealer_cost' => 0,
            'image_name_lg' => '',
            'retail_price' => '11.95',
            'manufacturer' => 'Fly Tying Tools',
            'size' => '',
            'image_name_sm' => 'W3009.jpg',
            'model' => 'Hair Stacker X-Large',
            'color' => 'Cocoboblo'
          },

The sympton is that the "color" column is truncated from "Cocobolo" to "C".

- Ian



Reply via email to