CurtTilmes / perl6-dbmysql

DB::MySQL
2 stars 3 forks source link

NULL string interpreted as empty string #4

Closed bbkr closed 5 years ago

bbkr commented 5 years ago

To reproduce:

CREATE TABLE foo ( bar char(1) ) engine=InnoDB;
INSERT INTO foo (bar) VALUES (NULL);
$mysql.execute("SELECT bar FROM foo").value.perl.say;

Result (should be Any()):

""

Same applies to VARCHAR type.

CurtTilmes commented 5 years ago

Thanks for testing!

Fixed typed NULL handling with commit 288dc45eee410bda5a6bc0c41b062a73212c565d

bbkr commented 5 years ago

Thanks for super-quick fix! Works great.

BTW: Returning undefined specific types instead of Any:U is great idea. One advantage I've immediately found is that it allows to pass data from database straight to Perl functions with narrow signatures making the code more compact.

Thanks again for your time invested in this module.