I commented out stuff I was just testing. I don't know what placeholders are in this context. I think the tutorial I am reading online has a section on it that I am not up to.
#!\C:\Strawberry\perl\bin\perl use strict; use warnings; use DBI; use DBD::mysql; use String::CRC32; #DATA SOURCE NAME my $dsn = "dbi:mysql:database=$database;host=$host;port=$port"; #PERL DBI CONNECT my $dbh=DBI->connect($dsn,$user,$pw, { PrintError => 0, RaiseError => 1, AutoCommit => 1, }) or die $DBI::errstr; #Read input file to load into DB open(INFILE, "<$ARGV[0]") or die "cannot open file:$!\n"; <INFILE>; #skip header for(<INFILE>){ #split line my @line=split("\t", $_); #check correct number of columns if (scalar(@line)>=11) { #parse columns my $chr=$line[0]; my $pos=$line[1]; my $sequence=$line[2]; #insert sequence my $crc32=crc32("$sequence"); #check crc32 of sequence print unpack($crc32)."\n"; my $th=$dbh->prepare(qq(SELECT COUNT(1) FROM Sequence WHERE Se +q_Checksum=$crc32)); $th->execute(); my $test=$th->fetch()->[0]; print "$test\n"; #if ($th->fetch()->[0]) { # print "Sequence already in database!\n"; #} #else { # print "New sequence detected, inserting into database wit +h unique checksum.\n"; # $dbh->do("INSERT INTO Sequence(Sequence) VALUES($sequence +)"); # $dbh->do("INSERT INTO Sequence(Seq_Checksum) VALUES($crc3 +2)"); # #} # } }

In reply to Re^2: checking mySQL database for unique CRC32 as proxy for long string by diyaz
in thread checking mySQL database for unique CRC32 as proxy for long string by diyaz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.