Le 2012-10-22 15:35, Paul van Helden a écrit :
It would be possible to implement TRUNCATE TABLE on top of that, but
this would be only syntactic sugar.
..or better portability. TRUNCATE TABLE works (since only a few years)
nearly everywhere. So when writing portable applications it seems a bit
silly to make an exception for SQLite if the solution is that simple and
won't break anything.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Personally, I have ask the question why TRUNCATE TABLE don't work
because this command is not listed on http://www.sqlite.org/omitted.html
This site list the non-supported feature of SQL92 standard and TRUNCATE
TABLE is not listed so it should work. Even if I built programs since 2003,
the use of database has never been necessary until last week. In one
week I have figure out enough of functionality to use them but what
command is part of this standard and what is not it's little bit
difficult to know for a database newbie like me. Anyway Something I can
do with
PureBasic is :
Procedure.b TruncateDatabaseTable(DataBaseID.l, TableName.s)
If DatabaseUpdate(DatabaseID, "TRUNCATE TABLE " + TableName)
Protected Success.b = #True
Else
If DatabaseUpdate(DatabaseID, "DELETE * FROM " + TableName)
Success = #True
Else
If DatabaseUpdate(DatabaseID, "DELETE FROM " + TableName)
Success = #True
Else
Success = #False
EndIf
EndIf
EndIf
ProcedureReturn Success
EndProcedure
If "TRUNCATE TABLE" fail the procedure fall back to "DELETE * FROM" and
if this fail the procedure try "DELETE FROM" then if this also fail give
up and return #false. Little bit intense for a simple database operation
but as long as it work, I'm happy.
Best regards
Guillaume
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users