import sqlite3

from common.constants import SQLITE_DB_PATH

conn = sqlite3.connect(SQLITE_DB_PATH)
c = conn.cursor()

# Test LOWER on Vietnamese text
c.execute("SELECT COUNT(*) FROM sr__test_db__magento_product_dimension_with_text_embedding WHERE LOWER(product_line_vn) = ?", ("áo phông",))
print(f"LOWER match 'áo phông': {c.fetchone()[0]}")

c.execute("SELECT COUNT(*) FROM sr__test_db__magento_product_dimension_with_text_embedding WHERE product_line_vn = ?", ("Áo phông",))
print(f"EXACT match 'Áo phông': {c.fetchone()[0]}")

# Test: what does LOWER('Áo phông') produce in SQLite?
c.execute("SELECT LOWER('Áo phông')")
print(f"LOWER('Áo phông') = '{c.fetchone()[0]}'")

# Also test
c.execute("SELECT LOWER('Quần soóc')")
print(f"LOWER('Quần soóc') = '{c.fetchone()[0]}'")

conn.close()
