Subject Re: [firebird-php] Hits and stats counters ....
Author masotti
Hi Lester,

Lester Caine wrote:
> I've had a problem with bitweaver since day one, but since it only happened very
> 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

Default transactions are IBASE_WRITE | IBASE_CONCURRENCY | IBASE_WAIT,
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.