Uploaded image for project: 'CUBRID APIs'
  1. CUBRID APIs
  2. APIS-591

When bind value is "undef", NULL should be inserted with no warning

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Perl-Aprium
    • Fix Version/s: Perl 9.1.0.0002
    • Component/s: Perl Driver
    • Labels:
      None
    • Environment:

      DBD::cubrid module v9.1.0.0001
      CUBRID Server v9.1.0

      Description

      Originally reported at http://www.cubrid.org/694768.

      Hi,

      I'm using the DBD::cubrid module v9.1.0.0001 and server v9.1.0, here is a short test:

      {code}
      #!/bin/env perl

      use strict;
      use warnings;
      use DBI;

      my $dbname = 'sqitch';
      my $user = 'user';
      my $pass = 'pass';

      my $dsn = qq{dbi:cubrid:database=$dbname;host=localhost;port=33000};

      my $dbh = DBI->connect(
      $dsn, $user, $pass,
      { AutoCommit => 1, RaiseError => 1, PrintError => 1, }
      ) or die $DBI::errstr;

      my ( $proj, $uri, $puser, $email )
      = ( 'engine', undef, 'Marge Simpson', 'marge@example.com' );

      my $sql = <<"SQL";
      INSERT INTO projects (project, uri, creator_name, creator_email)
      VALUES (?, ?, ?, ?);
      SQL

      my $sth= $dbh->prepare($sql) or die $DBI::errstr;
      $sth->execute($proj, $uri, $puser, $email) or die $DBI::errstr;

      $dbh->disconnect;{code}

      The problem is that I get a warning : Use of uninitialized value in subroutine entry at test-cubrid.pl line 30. That is the line with the execute statement. Again, this is not the behaviour the other drivers have.

      Note that if warnings is off the warning is not thrown, obviously, but the desired behaviour is to insert a NULL, and it does, and not throw any warnings, even with warnings set to on.

      Thanks,
      Stefan

        Activity

        Hide
        cn15800 谢韦华[Bert] added a comment -

        Dbi offer a system function to convert data type.If input parameter of the function is undef, it will thrown a warning,but the data will insert into cubrid successful.

        We can check the parameter, if the parameter is undef, it will be set null and doesn't call the system function.

        Show
        cn15800 谢韦华[Bert] added a comment - Dbi offer a system function to convert data type.If input parameter of the function is undef, it will thrown a warning,but the data will insert into cubrid successful. We can check the parameter, if the parameter is undef, it will be set null and doesn't call the system function.
        Hide
        cn15800 谢韦华[Bert] added a comment -

        fixed

        Show
        cn15800 谢韦华[Bert] added a comment - fixed

          People

          • Assignee:
            cn15800 谢韦华[Bert]
            Reporter:
            kadishmal Esen Sagynov
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: