in reply to DBI search for forward slash

How can I perform exact search strings with with slashes?

Like this:

use strict; use warnings; use DBI; use Test::More tests => 2; my $dbh = DBI->connect('dbi:SQLite:dbname=/tmp/testdb','',''); $dbh->do ('CREATE TABLE foo (bar VARCHAR(255) NOT NULL)'); my $sth = $dbh->prepare ('INSERT INTO foo values (?)'); $sth->execute ('This has no slashes'); $sth->execute ('/a/b/c'); my $want = '/a/b/c'; $sth = $dbh->prepare ('SELECT * FROM foo WHERE bar = ?'); my $res = $sth->execute ($want); ok $res, 'True result'; my ($str) = $sth->fetchrow_array; is $str, $want, 'Strings match';

Essential reading:


🦛