Re: RFC on other database wrapper modules

2005-07-21 Thread Gav....
It's a shame I think you only got the two responses back,
but I don't really think I know enough to contribute to
what you are asking.

Gav...

- Original Message - 
From: Darren Duncan [EMAIL PROTECTED]
To: dbi-users@perl.org
Sent: Thursday, July 21, 2005 9:50 AM
Subject: Re: RFC on other database wrapper modules


| Thanks for the 2 responses I got for this email.  They are aggregated
| below for your perusal.  Next I will go and write my Lightning Talk.
| -- Darren Duncan
|
| --
|
| At 7:05 AM -0400 7/19/05, John Siracusa wrote:
| On 7/19/05 5:05 AM, Darren Duncan wrote:
|   Also list the features the modules do provide that you wouldn't want
|   to give up, particularly if very few modules support those features
|   and others don't.
| 
| I use a module (Rose::DB) that parses and formats db-specific column 
values
| for me: various kinds of dates, SETs, arrays, all the crazy db-specific
| data types that are a pain to manually parse and then format.  Very few 
DBI
| abstraction modules provide this feature, but IMO it's essential.
| 
| -John
|
| --
|
| At 2:58 PM + 7/19/05, Terrence Brannon wrote:
| Darren Duncan [EMAIL PROTECTED] writes:
| 
|   This is a quick RFC concerning database wrapper modules and
|   frameworks, large and small, which are quite common on CPAN;
|   specifically it concerns such things that are not any of my creations.
| 
|   I am going to propose a Lightning Talk for OSCON in the next few days
|   (deadline is July 22, a practice is on July 19th) on the subject of
|   databases and SQL generation and portability and such things.
| 
| 
| The best survey of database wrappers I have seen is here:
| 
| 
 http://search.cpan.org/~evo/DBIx-SQLEngine-0.93/SQLEngine/Docs/Related.pod
|
| --
|
|
| -- 
| No virus found in this incoming message.
| Checked by AVG Anti-Virus.
| Version: 7.0.323 / Virus Database: 267.9.2/53 - Release Date: 20/07/2005
|
| 



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.9.2/53 - Release Date: 20/07/2005



Re: Seeking advice on DBI,DBD on Windows for multiple RDBMS

2005-06-02 Thread Gav....

| --downloading activeperl, which then requires that I
| install MS C runtime libraries.


Does it, I have never had to do that.

http://minitutorials.com/apache/stats11.shtml

Gav...


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.322 / Virus Database: 267.5.0 - Release Date: 2/06/2005



Re: db or file access?

2005-04-13 Thread Gav....

From: Bart Lateur

| It would be nice, IMHO, if your site had some sort of blog-like
| structure, so that people could comment on the site itself.

Good Idea,

|
| BTW I tend to agree with you, without actually being convinced of its
| technological superiority. BTW one can use mod_rewrite to nicen up the
| URL for images.
|
| But files inside databases tend to blow up the actual database files.
| There's a lot of air in databases. Wasted disk space.

I seem to be getting confused here about databases and file structures.
Yes, a database holds data, when it comes to images, does the database
not hold a pointer to the image? At the end of the day, the database itself
is held on the hard drive the same as any other file in sectors as '1's and 
'0's
so ultimately come from the same source. A database structure may seem to
be held in one place, but is still probably fragmented all over the place.

I am open to correction, my flame retardant suit is on and ready :)

Gav... 



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.7 - Release Date: 12/04/2005



Re: Sending Mail

2005-03-26 Thread Gav....
| If you were using the recommended pragma
|   use warnings;
| at the beginning of the script (or running perl -w), you would have
| found earlier that @myisp was being misinterpreted, with a warning
| message like this:
|   Possible unintended interpolation of @myisp in string at ...
|   Name main::myisp used only once: possible typo at ...

Thanks for that, now hopefully using the recommended warnings correctly.

Gav...


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.1 - Release Date: 23/03/2005



Re: Sending Mail

2005-03-26 Thread Gav....
Thanks, I'll have a look at this also. Is this the recommended way then for
what I am doing with the data.?

Gav...

| Also, I would recommend you consider using placeholders for all values
| passed to your prepare statement. 
|  
| eg.  my $sth = $dbh-prepare('SELECT email_address FROM users WHERE
| email_address = ?') || die $dbh-errstr(); 
| $sth-execute($email) || die $dbh-errstr(); 
| 
| but looking at your query I think you would be better off doing: 
| 
| my $rec = $dbh-selectrow_hashref(EOS,{}, $email) || die
| $dbh-errstr(); 
|  SELECT email_address FROM email_address WHERE email_address = ? 
| EOS 
| 
| print $rec-{email_address},$/; 
|  



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.3 - Release Date: 25/03/2005



Re: A good Perl Book

2005-03-26 Thread Gav....
Thanks everyone for your suggestions on good Perl books to have.

I will check them all out and then decide on one or two to begin with.

Gav...


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.3 - Release Date: 25/03/2005



Re: Sending Mail

2005-03-25 Thread Gav....
Thanks Michael,

I have taken on board and implemented your changes re:error checking etc.

Actually, my code did work apart from this one line :-

my $sth = $dbh-prepare(SELECT email_address FROM users)

The above is what I quoted you, which now works, but for testing I did not 
want to send out to all users so amended it to

my $sth = $dbh-prepare(SELECT email_address FROM users WHERE 
email_address='[EMAIL PROTECTED]')

The above line did not work, so the address was not found, guess who forgot 
to escape the @ !!

my $sth = $dbh-prepare(SELECT email_address FROM users WHERE 
email_address='[EMAIL PROTECTED]')

Now this worked fine, so did the rest of the script. Error checking did not 
help in this case though, it simply could not
find it in the database beacuse it wasnt sending the full email address to 
look for without the \.

Thanks for your help

Gav... 



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.1 - Release Date: 23/03/2005



A good Perl Book

2005-03-25 Thread Gav....
Hi Guys,

Considering the other thread re: Sending Mail is about my level of expertise 
in Perl,
what would you recomend as a good book to become an expert of sorts.?

I have looked at getting Programming the Perl DBI
by Alligator Descartes, Tim Bunce

more on this web page 
http://www.amazon.com/exec/obidos/ASIN/1565926994/webmasterresou05/102-9550958-5588144


I guess there may be a bit of bias coming up from certain quarters :)

Will any of the above site do me, is there a 2004 or 2005 edition of any 
Perl Books around?
I dont really want to concentrate on the DBI, a good all round book that 
delves quite deep
will do me :)

Gav...(Hope the list doesn't mind this type of question in here!) 



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.1 - Release Date: 23/03/2005



Sending Mail

2005-03-24 Thread Gav....
Hi All,

Finally, a newsgroup where I haven't got a clue (most of the time) what you 
lot are talking about!

Anyway, above statement proving my newbie status so I need help with :

Retrieve email addresses from 'email_address' field in 'users' database.
Send out email from email.txt file to all those addresses.

Seems simple , and I can do it no problem by reteiving the email addresses 
from another addresses.txt file
but not from the database. It is obviously the syntax that is wrong, but 
being new to perl I can't figure
it out.

Can someone point me as to what is wrong with this :-


#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:standard);
use DBI;
$|=1;


open(MESSAGE, /home/site/public_html/cgi-bin/email.txt) or die cannot 
open message: $!;
flock(MESSAGE, 2) or die cannot lock message exclusively: $!;
my @msgfile = MESSAGE;
close (MESSAGE) or die cannot close message file: $!;


my ($dbh, $sth, @row);
$dbh = open_dbi();
my $sth = $dbh-prepare(SELECT email_address FROM users);
$sth-execute();
while(@row = $sth-fetchrow_array){
$address = $row[0];
chomp($address);
open (SENDMAIL, |/usr/sbin/sendmail -t) or die cannot open sendmail: $!;
print SENDMAIL To:$address\n;
print SENDMAIL From: [EMAIL PROTECTED];
print SENDMAIL Subject: ITgazette $address\n\n;
print SENDMAIL @msgfile;
}

sub open_dbi
{
my $host = 'localhost';
my $db = 'databasename';
my $db_user = 'username';
my $db_password = 'password';
my $dbh = DBI-connect(dbi:mysql:$db:$host, $db_user, $db_password,
{RaiseError = 0, PrintError = 0} )
or err_trap(Cannot connect to the database);
return $dbh;
}# end: open_dbi


sub err_trap
{
my $error_message = shift(@_);
die $error_message\n
ERROR: $DBI::err ($DBI::errstr)\n;
}# end: err_trap

$sth-finish;
$dbh-disconnect();

print Location: http://sitename/index.php\n\n;;

---

It does not produce an error message, it just does not send the emails 
out,but it does redirect to the location.

Thanks for your help,



Gav...



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.1 - Release Date: 23/03/2005