[SQLite] Deleted rows count - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [SQLite] Deleted rows count (
/showthread.php?tid=643762)
[SQLite] Deleted rows count -
Jefff - 26.10.2017
Is there in sqlite something? i know i can use
pawn Код:
SELECT * FROM table WHERE nick = '%s'
and then num_rows but im asking about one query
pawn Код:
DELETE FROM table WHERE nick = '%s'
and next how many rows are deteled ?
Re: [SQLite] Deleted rows count -
PatrickGTR - 26.10.2017
You could use
to return the recent changes in your database
For example this is your database structure.
pawn Код:
-> table_name
- row 1 ->
- row 2 ->
- row 3 ->
- row 4 ->
- row 5 ->
- row 6 ->
All rows with the name of 'Patrick'
then you run a query
pawn Код:
DELETE FROM table_name WHERE username = 'Patrick'
then you run the
changes() function, which will return the number of rows that has been deleted.
Re: [SQLite] Deleted rows count -
Jefff - 27.10.2017
Sure but i need another query as my first example, im asking about
pawn Код:
DELETE FROM table WHERE nick = 'Patrick'
new rows = db_num_rows();
or something like this
Re: [SQLite] Deleted rows count -
PatrickGTR - 27.10.2017
Quote:
Originally Posted by Jefff
Sure but i need another query as my first example, im asking about
pawn Код:
DELETE FROM table WHERE nick = 'Patrick' new rows = db_num_rows();
or something like this
|
You could execute 2 statements in 1 query by using semicolon
' ; ' to separate them.
pawn Код:
new
DBResult:res;
res = db_query(dbHandle, "DELETE FROM table_name where nick = 'Patrick'; SELECT changes()");
printf("deleted rows = %i", db_get_field_int(res)); //this will print the deleted rows, or the recent changes.
db_free_result(res);
Re: [SQLite] Deleted rows count -
Jefff - 27.10.2017
Ok nice xd solved!