From ef0bc3e81ad5ed919c36a8cc318c8ebe3f8c48b7 Mon Sep 17 00:00:00 2001 From: Firat Date: Sun, 12 May 2024 16:04:17 +0100 Subject: [PATCH 1/3] gh-118469: Add `Date`, `Time` and `Timestamp` constructors. --- Doc/library/sqlite3.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 5dc22a7e431ae4..215b6f4d2785c6 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -424,6 +424,17 @@ Module functions Note: *typename* and the name of the type in your query are matched case-insensitively. +.. function:: Date(year, month, day, /, tzinfo=None, *, fold=0) + + Construct a date instance as :class:`datetime.date`. + +.. function:: Time(hour, minute, second, /, tzinfo=None, *, fold=0) + + Construct a time instance as :class:`datetime.time`. + +.. function:: Timestamp(year, month, day, /, hour=0, minute=0, second=0, tzinfo=None, *, fold=0) + + Construct a time stamp instance as :class:`datetime.datetime`. .. _sqlite3-module-constants: From 4c89b2cb8094206c85eb038320b6d2982c9b8b71 Mon Sep 17 00:00:00 2001 From: Firat Date: Sun, 12 May 2024 16:06:14 +0100 Subject: [PATCH 2/3] gh-118469: Add `DateFromTicks`, `TimeFromTicks` and `TimestampFromTicks` constructors. --- Doc/library/sqlite3.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 215b6f4d2785c6..d367384d66c349 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -436,6 +436,19 @@ Module functions Construct a time stamp instance as :class:`datetime.datetime`. +.. function:: DateFromTicks([secs]) + + Construct a :class:`~sqlite3.Date` instance from the given number of seconds since the epoch, converted to local time. + (see the documentation of the standard Python :mod:`time` module and its :func:`~time.localtime` function for details). + +.. function:: TimeFromTicks([secs]) + + Constructs a :class:`~sqlite3.Time` instance from the given number of seconds since the epoch, converted to local time. + +.. function:: TimestampFromTicks([secs]) + + Construct a :class:`~sqlite3.Timestamp` from the given number of seconds since the epoch, converted to local time. + .. _sqlite3-module-constants: Module constants From e73461a4630346473dcc6db4ddecad0ff7a497c0 Mon Sep 17 00:00:00 2001 From: Firat Date: Sun, 12 May 2024 18:51:51 +0100 Subject: [PATCH 3/3] gh-118469: Add `Binary` constructor. --- Doc/library/sqlite3.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index d367384d66c349..c36b49a5b25acb 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -449,6 +449,10 @@ Module functions Construct a :class:`~sqlite3.Timestamp` from the given number of seconds since the epoch, converted to local time. +.. function:: Binary(object) + + Construct a BLOB as a :class:`memoryview` from a :term:`bytes-like object`. + .. _sqlite3-module-constants: Module constants