Subject | Re: [firebird-php] Hits and stats counters .... |
---|---|
Author | masotti |
Post date | 2010-04-19T08:13:35Z |
Hi Lester,
Lester Caine wrote:
so you need to alter default transaction in client library to IBASE_READ
| IBASE_COMMITED | IBASE_REC_VERSION | IBASE_NO_WAIT.
To update database don't use default connection, but peek another
connection from pool and use an explicit transaction.
To peek a different connection from pool to the same database may work
if you define a different user or a different connection character set
so both connection will be pooled.
$db0 = ibase_pconnect ( $dbase, $another_user, $another_pass );
$trx = ibase_trans ( IBASE_WRITE | IBASE_COMMITTED |
IBASE_RECORD_VERSION | IBASE_WAIT, $db0 );
$qry = "LC_HITS SET hits = hits + 1, last_hit = NOW WHERE content_id = xxx";
$cnt = ibase_query ( $db0, $qry );
ibase_commit ( $tr0 );
This is only theory, never had chance to test.
Ciao.
Mimmo.
Lester Caine wrote:
> I've had a problem with bitweaver since day one, but since it only happened veryDefault transactions are IBASE_WRITE | IBASE_CONCURRENCY | IBASE_WAIT,
> occasionally I'd chosen to ignore it. With the traffic through my sites
> increasing it has become a more serious problem, and I need to look at doing
> something about it.
>
> Query is simple enough
> UPDATE LC_HITS SET hits = hits + 1, last_hit = NOW WHERE content_id = xxx
so you need to alter default transaction in client library to IBASE_READ
| IBASE_COMMITED | IBASE_REC_VERSION | IBASE_NO_WAIT.
To update database don't use default connection, but peek another
connection from pool and use an explicit transaction.
To peek a different connection from pool to the same database may work
if you define a different user or a different connection character set
so both connection will be pooled.
$db0 = ibase_pconnect ( $dbase, $another_user, $another_pass );
$trx = ibase_trans ( IBASE_WRITE | IBASE_COMMITTED |
IBASE_RECORD_VERSION | IBASE_WAIT, $db0 );
$qry = "LC_HITS SET hits = hits + 1, last_hit = NOW WHERE content_id = xxx";
$cnt = ibase_query ( $db0, $qry );
ibase_commit ( $tr0 );
This is only theory, never had chance to test.
Ciao.
Mimmo.