| @@ -324,6 +324,7 @@ class VideoDao: | |||
| id = %s | |||
| ORDER BY | |||
| id""", (video_id,)) | |||
| print (c._executed) | |||
| row = cast (VideoRow | None, c.fetchone ()) | |||
| if row is None: | |||
| return None | |||
| @@ -346,6 +347,7 @@ class VideoDao: | |||
| videos | |||
| ORDER BY | |||
| id""") | |||
| print (c._executed) | |||
| videos: list[VideoDto] = [] | |||
| for row in cast (list[VideoRow], c.fetchall ()): | |||
| videos.append (self._create_dto_from_row (row, with_relation_tables)) | |||
| @@ -367,6 +369,7 @@ class VideoDao: | |||
| videos | |||
| WHERE | |||
| deleted_at IS NULL""") | |||
| print (c._executed) | |||
| videos: list[VideoDto] = [] | |||
| for row in cast (list[VideoRow], c.fetchall ()): | |||
| videos.append (self._create_dto_from_row (row, False)) | |||
| @@ -411,6 +414,7 @@ class VideoDao: | |||
| video.description, | |||
| video.uploaded_at, | |||
| deleted_at)) | |||
| print (c._executed) | |||
| video.id_ = c.lastrowid | |||
| if with_relation_tables: | |||
| if video.video_tags is not None: | |||
| @@ -443,6 +447,7 @@ class VideoDao: | |||
| deleted_at = %%s | |||
| WHERE | |||
| id IN (%s)""" % ', '.join (['%s'] * len (video_ids)), (at, *video_ids)) | |||
| print (c._executed) | |||
| def _create_dto_from_row ( | |||
| self, | |||
| @@ -507,6 +512,7 @@ class VideoTagDao: | |||
| video_id = %s | |||
| ORDER BY | |||
| id""", (video_id,)) | |||
| print (c._executed) | |||
| video_tags: list[VideoTagDto] = [] | |||
| for row in cast (list[VideoTagRow], c.fetchall ()): | |||
| video_tags.append (self._create_dto_from_row (row, with_relation_tables)) | |||
| @@ -532,6 +538,7 @@ class VideoTagDao: | |||
| AND (untagged_at IS NULL) | |||
| ORDER BY | |||
| id""", (video_id,)) | |||
| print (c._executed) | |||
| video_tags: list[VideoTagDto] = [] | |||
| for row in cast (list[VideoTagRow], c.fetchall ()): | |||
| video_tags.append (self._create_dto_from_row (row, with_relation_tables)) | |||
| @@ -556,6 +563,7 @@ class VideoTagDao: | |||
| WHERE | |||
| video_id = %s | |||
| AND tag_id = %s""", (video_id, tag_id)) | |||
| print (c._executed) | |||
| row = cast (VideoTagRow, c.fetchone ()) | |||
| if row is None: | |||
| return None | |||
| @@ -588,6 +596,7 @@ class VideoTagDao: | |||
| %s, | |||
| %s)""", (video_tag.video_id, video_tag.tag_id, | |||
| video_tag.tagged_at, untagged_at)) | |||
| print (c._executed) | |||
| video_tag.id_ = c.lastrowid | |||
| if with_relation_tables: | |||
| if video_tag.video is not None: | |||
| @@ -630,6 +639,7 @@ class VideoTagDao: | |||
| video_tag.tag_id, | |||
| video_tag.tagged_at, | |||
| untagged_at)) | |||
| print (c._executed) | |||
| video_tag.id_ = c.lastrowid | |||
| if with_relation_tables: | |||
| if video_tag.video is not None: | |||
| @@ -662,6 +672,7 @@ class VideoTagDao: | |||
| WHERE | |||
| video_id = %%s | |||
| AND tag_id IN (%s)""" % ', '.join (['%s'] * len (tag_ids)), (now, video_id, *tag_ids)) | |||
| print (c._executed) | |||
| def _create_dto_from_row ( | |||
| self, | |||
| @@ -710,6 +721,7 @@ class TagDao: | |||
| tags | |||
| WHERE | |||
| id = %s""", (tag_id,)) | |||
| print (c._executed) | |||
| row = cast (TagRow | None, c.fetchone ()) | |||
| if row is None: | |||
| return None | |||
| @@ -728,6 +740,7 @@ class TagDao: | |||
| tags | |||
| WHERE | |||
| name = %s""", (tag_name,)) | |||
| print (c._executed) | |||
| row = cast (TagRow | None, c.fetchone ()) | |||
| if row is None: | |||
| return None | |||
| @@ -743,6 +756,7 @@ class TagDao: | |||
| tags(name) | |||
| VALUES | |||
| (%s)""", (tag.name,)) | |||
| print (c._executed) | |||
| tag.id_ = c.lastrowid | |||
| def upsert ( | |||
| @@ -758,6 +772,7 @@ class TagDao: | |||
| ON DUPLICATE KEY UPDATE | |||
| id = LAST_INSERT_ID(id), | |||
| name = VALUES(name)""", (tag.name,)) | |||
| print (c._executed) | |||
| tag.id_ = c.lastrowid | |||
| def _create_dto_from_row ( | |||
| @@ -797,6 +812,7 @@ class VideoHistoryDao: | |||
| video_histories | |||
| WHERE | |||
| video_id = %s""", (video_id,)) | |||
| print (c._executed) | |||
| video_histories: list[VideoHistoryDto] = [] | |||
| for row in cast (list[VideoHistoryRow], c.fetchall ()): | |||
| video_histories.append (self._create_dto_from_row (row, with_relation_tables)) | |||
| @@ -820,6 +836,7 @@ class VideoHistoryDao: | |||
| %s)""", (video_history.video_id, | |||
| video_history.fetched_at, | |||
| video_history.views_count)) | |||
| print (c._executed) | |||
| def upsert ( | |||
| self, | |||
| @@ -844,6 +861,7 @@ class VideoHistoryDao: | |||
| views_count = VALUES(views_count)""", (video_history.video_id, | |||
| video_history.fetched_at, | |||
| video_history.views_count)) | |||
| print (c._executed) | |||
| def upsert_all ( | |||
| self, | |||
| @@ -902,6 +920,7 @@ class CommentDao: | |||
| comments | |||
| WHERE | |||
| video_id = %s""", (video_id,)) | |||
| print (c._executed) | |||
| comments: list[CommentDto] = [] | |||
| for row in cast (list[CommentRow], c.fetchall ()): | |||
| comments.append (self._create_dto_from_row (row, with_relation_tables)) | |||
| @@ -954,6 +973,7 @@ class CommentDao: | |||
| comment.posted_at, | |||
| comment.nico_count, | |||
| vpos_ms)) | |||
| print (c._executed) | |||
| def upsert_all ( | |||
| self, | |||
| @@ -1015,6 +1035,7 @@ class UserDao: | |||
| users | |||
| WHERE | |||
| code = %s""", (user_code,)) | |||
| print (c._executed) | |||
| row = cast (UserRow | None, c.fetchone ()) | |||
| if row is None: | |||
| return None | |||
| @@ -1030,6 +1051,7 @@ class UserDao: | |||
| users(code) | |||
| VALUES | |||
| (%s)""", (user.code,)) | |||
| print (c.execute) | |||
| user.id_ = c.lastrowid | |||
| def _create_dto_from_row ( | |||