Re: [phplib] mssql_affected_rows does not exist in php From: Michael Anthon (michael <email protected>)
Date: 10/21/00

Mark,
Search the archives for my name for more info on this problem. I have a
patch for an earlier version of PHP3 at work. If you want it, send an
email to michael.anthon <email protected> and I will mail it to you. We
made this patch some time ago but the changes are still relevant.

Briefly, the patch fixes the PHP mssql_numrows() function (I think, from
memory) to correctly return the right value under all conditions, then
we changed the function call in db_mssql.inc to call that function
instead.

Cheers
Michael

Mark Burnette wrote:
>
> In db_mssql.inc class DB_Sql has the member function:
>
> function affected_rows() {
> return mssql_affected_rows($this->Query_ID);
> }
>
> but mssql_affected_rows does not exist. MySQL has mysql_affected_rows and I
> believe that other databases do as well but Microsoft SQL Server does not.
> phplib calls affected_rows in ct_sql.inc. The sample pages also call
> affected_rows but these are technically not part of phplib. For phplib 7.2c
> the fix for ct_sql.inc is:
>
> Replace:
>
> # if ( $this->db->affected_rows() == 0
> # && $this->db->query($squery)
> # && $this->db->f(1) == 0
> # && !$this->db->query($iquery)) {
>
> # $ret = false;
> # }
>
> With:
>
> if ( $this->db->query($squery)
> && $this->db->f(1) == 0
> && !$this->db->query($iquery)) {
>
> $ret = false;
> }
>
> This simply checks to see if there is already a record in the table and if
> not it runs the insert query. phplib will generate an error under MS SQL
> Server if this fix is not made. Hopefully, they will correct this in future
> releases. The same issue occurs in phplib 7.2b with a similar fix.
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: phplib-unsubscribe <email protected>
> For additional commands, e-mail: phplib-help <email protected>

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>