#!/usr/bin/env python3
"""
진피 관련 약재 찾기
"""

import sqlite3

conn = sqlite3.connect('database/kdrug.db')
cursor = conn.cursor()

# 진피 관련 약재 검색
cursor.execute("""
    SELECT ingredient_code, herb_name, herb_name_hanja
    FROM herb_masters
    WHERE herb_name LIKE '%진피%'
       OR herb_name = '진피'
       OR herb_name = '陳皮'
    ORDER BY herb_name
""")

results = cursor.fetchall()

print("🌿 진피 관련 약재 검색 결과:")
print("="*60)
for code, name, hanja in results:
    print(f"{code}: {name} ({hanja})")

# 정확히 '진피'만 찾기
print("\n정확히 '진피' 검색:")
cursor.execute("""
    SELECT ingredient_code, herb_name, herb_name_hanja
    FROM herb_masters
    WHERE herb_name = '진피'
""")

result = cursor.fetchone()
if result:
    print(f"✅ 찾음: {result[0]}: {result[1]} ({result[2]})")
else:
    print("❌ 정확한 '진피'를 찾을 수 없음")

conn.close()