This commit is contained in:
gauthiier
2022-07-31 17:16:51 +02:00
parent 9c4cdb72ad
commit 14128a5db5
4 changed files with 73 additions and 1 deletions
+23
View File
@@ -267,6 +267,29 @@ class Archive:
finally:
cursor.close()
def select_all(self):
if self.db_con is None:
logging.warning("Not connection to database...")
return
try:
cursor = self.db_con.cursor(buffered=True)
cursor.execute(archive.sql.SELECT_ALL.format(self.archive_name))
# print(cursor.rowcount)
results = []
for (from_, author_name_, to_, subject_, date_, content_type_, content_, url_) in cursor:
results.append((from_, author_name_, to_, subject_, date_, content_type_, content_, url_))
# print("{} {} {}".format(from_, str(date_), url_))
return results
except mariadb.Error as error:
logging.error("Error: {}".format(error))
finally:
cursor.close()
# analysis
def longest_field(self, field, thread, max_length=0):
import archive.util
+3
View File
@@ -33,4 +33,7 @@ FROM_QUERY_NL = ("SELECT from_, author_name_, subject_, date_, url_ FROM {} "
SHOW_TABLE = "show tables"
SELECT_ALL = ("SELECT * FROM {} "
"ORDER BY date_")
# SELECT from_, author_name_, subject_, date_, url_ FROM nettime_l WHERE MATCH(content_) AGAINST('%s' IN BOOLEAN MODE)