I forgot to tell that the column 'PKintIDLog' (identity column) is
incremented as if the insert was done correctly. For example: I select the
max PKintIDLog column value and I got '20', then I try to insert some data
on the table via PHP, I select the max PKintIDLog (I should get '21', right
?), but I got '20' cuz I had no row affected. So I insert some data via ISQL
console, select the max PKintIDLog and I got '22'. Even with the
misinsertion the identity column is incremented. It's pretty weird, isn't it
?

================================================================

I don't know a lot about sybase, but if it's anything like oracle it works
like this:

A query from the console will be commited when the console is exited (plus
of course any select queries performing checks at the console will reveal
the result as it will be after the commit has occurred). With auto_commit
turned off, a php connection needs to tell the database to actually commit
before it breaks the connection (otherwise the transaction - ie update
query) will roll back, ie go back to the state it was before you attempted
the update. Therefore you wil lneed the sybase_query("commit") line in place
to commit the transaction.

Mark


-----Original Message-----
From: Nilo [mailto:[EMAIL PROTECTED]
Sent: 25 July 2003 15:42
To: php-general
Cc: lgjunior; Rodolfo
Subject: [PHP] PHP + Sybase - "auto_commit disabled"


My site got it's Sybase 'auto_commit' disabled, I mean, if I type a (INSERT,
UPDATE, DELETE) query on ISQL's console I got the correct result, but the
same doesn't happen when I run the query via PHP. Check the code below:

<?

//includes with database connection and stuff

$xSql= "INSERT INTO oab_mailing_logs (nvaNomeMailing, nvaInicioEnvio,
nvaFimEnvio, dtDataEnvio, numTamanhoMailing, intLidos) VALUES ('teste', '0',
'0', '2003-01-01', 0, 0)";
$xQuery = sybase_query($xSql);

if($xQuery) //sybase_query returns me nothing. $xQuery is not tested on the
'if' clause, it just pass through both 'if' and 'else'.
{
    "OK!<br>";
}
else
{
    "Erro!<br>";
}

//sybase_query("commit"); //if I uncomment 'sybase_query("commit")' I got
what I want, I mean, the INSERT is done correctly, but note that I hadn't to
do this before, it's just stop running as it used to

//echo "xQuery-> ".$xQuery."<br>"; //it outputs '1'

echo "Executando a query: <b>".$xSql."</b><br>";

echo "Linhas afetadas: ".sybase_affected_rows($xQuery); //there's not output
here... it's kinda empty

sybase_free_result($xQuery);

?>

I haven't got any kind of error message, even on Sybase errorlog.

Can you help me ?

Thanks and the best regards


----------------------------------------------------------------------------
--
Nilo
Desenvolvedor WEB
A B I L I T Y
Soluções interativas
+55 21 38526657
www.ability.com.br


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to