Unanswered: perl dbi access and the like statement
I'm having problems getting a SELECT ... LIKE statement to work within PERL using DBI connecting to the Access .mdb database.
my $stl = $dbh->prepare(<<SQL);
SELECT email, username, expirationdate, payment
from [Authentication Q]
WHERE email like ?;
is the statement that I'm using.
I would pass it a value like email@example.com but it's probably the @ that's causing problems although it doesn't give any errors.
I am getting the input from the keyboard STDIN
I can do without using the LIKE function and just use a = but when I input from STDIN an email address, it doesn't return any values either but if I assign the variable I am passing to the SQL statement (ie. user\@domain.com) - it returns what is expected - so I am sure here it's the @ that is causing the issue.
I have tried typing in user\@domain.com and firstname.lastname@example.org, stripping the trailing C/R and replacing the @ with \@ before calling the SQL - but no go.
So are there any tricks to using the LIKE statement with an ACCESS database with perl dbi or how could I get the @ sign from typed in data to match correctly?
I don't have nay working exp in access, however here are some questions which I would like to know:
1. Does "@" has got any special meaning in Access? If yes, then u have have escape it twice, one for the PERL script and one for the Access. Needless to say "@" has got special meaning in PERL script.
2. Can you let me know the exact value of the E-mail address just before the select stmt.....incluing any non-printable charatcers like "\n" etc etc. Also u can see the value (by using insert statement) of the variable being passed to the database.
3. The option which you can try is to keep the email adress in a file and read it from the script.