export
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user