Back to the month index |
Back to the list index
|
Andreas Koenig (k@anna.in-berlin.de)
Fri, 10 Jan 1997 12:24:37 +0100
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Next message: Andreas Koenig: "[mSQL] Re: problems with MsqlPerl-1.14 and 2.0b2"
- Previous message: Wayne Ward: "Re: [mSQL] mSQL 2 license cost"
- In reply to: Erik Liljencrantz: "[mSQL] mSQL 2 license cost"
- Next in thread: Wayne Dahl: "Re: [mSQL] perl/msql"
Date: Fri, 10 Jan 1997 12:24:37 +0100 Message-Id: <199701101124.MAA26078@anna.in-berlin.de> From: Andreas Koenig <k@anna.in-berlin.de> Subject: Re: [mSQL] perl/msql(Forwarded to the msqlperl mailing list from the msql-list)
>>>>> Bob Basques writes:
bob> Paul Bristow wrote:
>> My solution was a library file you require in your scripts. You call
>> &chkdbtable($table, $database) before runing the query. For
>> your purposes you could just use chktable. With hindsight you should
>> pass a database handle in to the subs to save the additional connections:
>>
>> #----------------------------------------------------------------
bob> I think that we are thinking along similar lines, I'm leaning toward
bob> this kind
bob> of solution. Its been suggested to just make the tables (complete area
bob> coverage)
bob> with no data and just query them like any other table, count the rows,
bob> if less than 1
bob> wahla, no data to return, no error either, I can generate the tables
bob> automatically no
bob> problem. Do you happen to know if this tack will be detrimental in the
bob> long run?
I usually do this:
% perl -I /usr/local/Minerva/perl/ -S pmsql
pmsql -- interactive mSQL monitor version 1.33
Readline support enabled
pmsql> !$DB=Msql->connect("","mod") and print "ok"
ok
pmsql> !print join ":", $DB->listtables
uris:chapters:mlas:maillists:mods:users:list2user:deletes:packages:distmtimes:mirrorit:perms
pmsql> !print grep {$_ eq "perms"} $DB->listtables
perms
The last command answers "perms" if and only if perms is an existing
table. It does so in "realtime", i.e. it does not reflect the
situation an hour or five hours before. You know, that "perms" is TRUE
in boolean context. So you usually need nothing more than
unless (grep {$_ eq "mlas"} $db->listtables) {
my $query = qq{
create table mlas (
mlaid char(64) primary key,
userid char(10),
admin char(64),
comment char(256),
changed char(10),
changedby char(10)
)
};
$db->query($query) or error($query,Msql->errmsg);
}
If this strategy is detrimental depends on the number of tables and
the number of listtables() request in a given period. See the
Benchmark module in your perl distribution and measure the benefits of
your approach and consider the costs it entails for maintanance and
for giving responses that are sometimes out of date and compare it
with the performance gain.
Hope, that helps,
andreas
--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!
- Next message: Andreas Koenig: "[mSQL] Re: problems with MsqlPerl-1.14 and 2.0b2"
- Previous message: Wayne Ward: "Re: [mSQL] mSQL 2 license cost"
- In reply to: Erik Liljencrantz: "[mSQL] mSQL 2 license cost"
- Next in thread: Wayne Dahl: "Re: [mSQL] perl/msql"