downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

sqlite_close> <sqlite_busy_timeout
Last updated: Fri, 20 May 2011

view this page in

sqlite_changes

SQLiteDatabase->changes

(PHP 5, PECL sqlite >= 1.0.0)

sqlite_changes -- SQLiteDatabase->changes Devuelve el número de filas que han sido cambiadas mediante la sentencia SQL más reciente.

Descripción

int sqlite_changes ( resource $dbhandle )

Estilo orientado a objetos (método):

int SQLiteDatabase::changes ( void )

Devuelve el número de filas que han sido cambiadas mediante la sentencia SQL más reciente ejecutada contra el manejador de base de datos dbhandle.

Parámetros

dbhandle

El recurso de base de datos devuelto desde sqlite_open(). Este parámetro no es requerido cuando se usa el método "Orientado a objetos".

Valores devueltos

Devuelve el número de filas cambiadas.

Ejemplos

Example #1 Estilo Procedural

<?php
$dbhandle 
sqlite_open('mysqlitedb');
$query sqlite_query($dbhandle"UPDATE users SET email='jDoe@example.com' WHERE username='jDoe'");
if (!
$query) {
    exit(
'Error in query.');
} else {
    echo 
'Number of rows modified: 'sqlite_changes($dbhandle);
}
?>

Example #2 Estilo Orientado a objetos

<?php
$dbhandle 
= new SQLiteDatabase('mysqlitedb');
$query $dbhandle->query("UPDATE users SET email='jDoe@example.com' WHERE username='jDoe'");
if (!
$query) {
    exit(
'Error in query.');
} else {
    echo 
'Number of rows modified: '$dbhandle->changes();
}
?>

Ver también

  • sqlite_open() - Opens an SQLite database and create the database if it does not exist



add a note add a note User Contributed Notes sqlite_changes
jazz at funkynerd dot com 01-Apr-2010 05:06
When executing DELETEs, I found that adding an always true WHERE clause returns the number of rows deleted.

eg:  "DELETE FROM my_table WHERE 1"  will delete all the rows and sqlite_changes() will return the correct number of rows deleted.
bermi ferrer:at-akelos dotCom 28-Sep-2005 01:02
When counting deleted records from the database, I realized that sqlite_changes() will return 0 if you are deleting all the records without including a WHERE clause.

So after "DELETE FROM users" sqlite_open() will print 0 even if rows where deleted, but if you use "DELETE FROM users WHERE 1" you will get the right result.

I had this problem on versions 5.0.4 and 4.4.0 under Windows servers.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites