I'm having a devil of a time trying to insert a Windows UNC share into my MySQL database. The DBI quote function doesn't seem to be behaving as I would expect. Here's a little example:
#!/usr/bin/perl -w use DBI; my $unc = '\\somebox.somehost.com\someshare'; my $dsn = "DBI:mysql:cmdb;localhost"; my $dbh = DBI->connect($dsn,'root','') or die; my $quoted_unc = $dbh->quote($unc); $dbh->do("INSERT INTO mytable (uncname) VALUE ($quoted_unc)"); $dbh->disconnect;
When I run this code, and then run a select against mytable, my UNC share is not the same as it was when it went in:
If I double-quote the unc variable like this:
my $unc = "\\somebox.somehost.com\someshare";
The result is different, but not much better:
Anyone know how to get around this problem?