On Friday, 5 July, 2019 12:26, Peng Yu <pengyu...@gmail.com>:

>There is something shown below that uses SQLite3, but it still does
>not go deeper into reimplementing using the raw code available from
>SQLite3. This implementation merely calls SQLite3.

>https://github.com/pypa/pip/blob/master/src/pip/_vendor/lockfile/sqlitelockfile.py#L14

>My take-home message from this code is that it might be difficult to
>just extract the part from SQLite3 that is for file locking.
>Otherwise, the author who wrote this piece of code probably should
>have done so already. However, for more efficient file locking, I
>think it probably makes sense to only extract the part for file
>locking SQLite3 and remove other parts SQLite3 to reduce overhead.

This does not implement SQLite3 locking.  It uses SQLite3 as a database in 
which to store information about that which is locked, and uses that database 
to implement a locking mechanism for other things.  It by happenstance uses an 
SQLite3 database to store the information, but it does not depend on it.  That 
is, the SQL would work against any database connection to an SQL database 
including SQL Server, DB2, or what have you.  (analogy:  A telephone book 
stores information about telephone numbers but does not implement a telephone).

In any event of the cause, the code is in error and will not work correctly (it 
is defective).  It also does not deal with race conditions very well.  

-- 
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.





_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to