Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: DBI search for forward slash

by hippo (Chancellor)
on Nov 08, 2020 at 11:43 UTC ( #11123502=note: print w/replies, xml ) Need Help??


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:


🦛

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11123502]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (1)
As of 2021-05-19 03:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (186 votes). Check out past polls.

    Notices?