38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
import fdb
|
|
|
|
conn = fdb.connect(
|
|
dsn=r'localhost:c:\medicus 3\data\medicus.fdb',
|
|
user='SYSDBA', password='masterkey', charset='win1250'
|
|
)
|
|
cur = conn.cursor()
|
|
|
|
print("=== NEJSTARŠÍ záznamy ===")
|
|
cur.execute("""
|
|
SELECT FIRST 5 ID, DATUM, DEKURS
|
|
FROM DEKURS
|
|
WHERE DEKURS IS NOT NULL
|
|
ORDER BY DATUM ASC
|
|
""")
|
|
for row in cur.fetchall():
|
|
text = row[2].read() if hasattr(row[2], 'read') else row[2]
|
|
if isinstance(text, bytes):
|
|
text = text.decode('windows-1250', errors='replace')
|
|
print(f"\n--- ID={row[0]} DATUM={row[1]} ---")
|
|
print(repr(text[:300]))
|
|
|
|
print("\n\n=== NEJNOVĚJŠÍ záznamy ===")
|
|
cur.execute("""
|
|
SELECT FIRST 5 ID, DATUM, DEKURS
|
|
FROM DEKURS
|
|
WHERE DEKURS IS NOT NULL
|
|
ORDER BY DATUM DESC
|
|
""")
|
|
for row in cur.fetchall():
|
|
text = row[2].read() if hasattr(row[2], 'read') else row[2]
|
|
if isinstance(text, bytes):
|
|
text = text.decode('windows-1250', errors='replace')
|
|
print(f"\n--- ID={row[0]} DATUM={row[1]} ---")
|
|
print(repr(text[:300]))
|
|
|
|
conn.close()
|