# Path: simplesqlite/_func.py
# def validate_table_name(name: str) -> None:
#     """
#     :param str name: Table name to validate.
#     :raises NameValidationError: |raises_validate_table_name|
#     """
# 
#     try:
#         validate_sqlite_table_name(name)
#     except ValidationError as e:
#         if e.reason == ErrorReason.RESERVED_NAME and e.reusable_name:
#             pass
#         else:
#             raise NameValidationError(e)
# 
# Path: simplesqlite/_validator.py
# def validate_sqlite_attr_name(name: str) -> None:
#     """
#     :param str name: Name to validate.
#     :raises pathvalidate.ValidationError:
#         - If the ``name`` includes unprintable character(s).
#         - |raises_sqlite_keywords|
#     """
# 
#     if not name:
#         raise ValidationError(["null name"], reason=ErrorReason.NULL_NAME)
# 
#     if __RE_INVALID_CHARS.search(name):
#         raise ValidationError(["unprintable character found"], reason=ErrorReason.INVALID_CHARACTER)
# 
#     name = name.upper()
# 
#     if name in __SQLITE_INVALID_RESERVED_KEYWORDS_ATTR:
#         raise ValidationError(
#             [f"'{name}' is a reserved keyword by sqlite"],
#             reason=ErrorReason.RESERVED_NAME,
#             reusable_name=False,
#         )
# 
#     if name in __SQLITE_VALID_RESERVED_KEYWORDS_ATTR:
#         raise ValidationError(
#             [f"'{name}' is a reserved keyword by sqlite"],
#             reason=ErrorReason.RESERVED_NAME,
#             reusable_name=True,
#         )
# 
# Path: simplesqlite/error.py
# class SqlSyntaxError(Exception):
#     """
#     Exception raised when a SQLite query syntax is invalid.
#     """


import abc
import re
import typepy
    import hashlib
from typing import Any, List, Optional, Sequence, Union
from pathvalidate import ascii_symbols, unprintable_ascii_chars
from pathvalidate.error import ErrorReason, ValidationError
from ._func import validate_table_name
from ._validator import validate_sqlite_attr_name
from .error import SqlSyntaxError
    :param str where:
        Add a WHERE clause to execute query, if the value is not |None|.
    :param extra extra:
        Add additional clause to execute query, if the value is not |None|.
    :raises ValueError: ``select`` is empty string.
    :raises simplesqlite.NameValidationError:
        |raises_validate_table_name|

    :Examples:
        >>> from simplesqlite.query import Select, Where
        >>> Select(select="value", table="example")
        'SELECT value FROM example'
        >>> Select(select="value", table="example", where=Where("key", 1))
        'SELECT value FROM example WHERE key = 1'
        >>> Select(select="value", table="example", where=Where("key", 1), extra="ORDER BY value")
        'SELECT value FROM example WHERE key = 1 ORDER BY value'
    """

    def __init__(
        self,
        select: Union[str, AttrList],
        table: str,
        where: Optional[WhereQuery] = None,
        extra: Optional[str] = None,
    ) -> None:
        self.__select = select
        self.__table = table
        self.__where = where
        self.__extra = extra


# Path: simplesqlite/_func.py
# def validate_table_name(name: str) -> None:
#     """
#     :param str name: Table name to validate.
#     :raises NameValidationError: |raises_validate_table_name|
#     """
# 
#     try:
#         validate_sqlite_table_name(name)
#     except ValidationError as e:
#         if e.reason == ErrorReason.RESERVED_NAME and e.reusable_name:
#             pass
#         else:
#             raise NameValidationError(e)
# 
# Path: simplesqlite/_validator.py
# def validate_sqlite_attr_name(name: str) -> None:
#     """
#     :param str name: Name to validate.
#     :raises pathvalidate.ValidationError:
#         - If the ``name`` includes unprintable character(s).
#         - |raises_sqlite_keywords|
#     """
# 
#     if not name:
#         raise ValidationError(["null name"], reason=ErrorReason.NULL_NAME)
# 
#     if __RE_INVALID_CHARS.search(name):
#         raise ValidationError(["unprintable character found"], reason=ErrorReason.INVALID_CHARACTER)
# 
#     name = name.upper()
# 
#     if name in __SQLITE_INVALID_RESERVED_KEYWORDS_ATTR:
#         raise ValidationError(
#             [f"'{name}' is a reserved keyword by sqlite"],
#             reason=ErrorReason.RESERVED_NAME,
#             reusable_name=False,
#         )
# 
#     if name in __SQLITE_VALID_RESERVED_KEYWORDS_ATTR:
#         raise ValidationError(
#             [f"'{name}' is a reserved keyword by sqlite"],
#             reason=ErrorReason.RESERVED_NAME,
#             reusable_name=True,
#         )
# 
# Path: simplesqlite/error.py
# class SqlSyntaxError(Exception):
#     """
#     Exception raised when a SQLite query syntax is invalid.
#     """


# Path: simplesqlite/query.py
import abc
import re
import typepy
    import hashlib
from typing import Any, List, Optional, Sequence, Union
from pathvalidate import ascii_symbols, unprintable_ascii_chars
from pathvalidate.error import ErrorReason, ValidationError
from ._func import validate_table_name
from ._validator import validate_sqlite_attr_name
from .error import SqlSyntaxError

    :param str where:
        Add a WHERE clause to execute query, if the value is not |None|.
    :param extra extra:
        Add additional clause to execute query, if the value is not |None|.
    :raises ValueError: ``select`` is empty string.
    :raises simplesqlite.NameValidationError:
        |raises_validate_table_name|

    :Examples:
        >>> from simplesqlite.query import Select, Where
        >>> Select(select="value", table="example")
        'SELECT value FROM example'
        >>> Select(select="value", table="example", where=Where("key", 1))
        'SELECT value FROM example WHERE key = 1'
        >>> Select(select="value", table="example", where=Where("key", 1), extra="ORDER BY value")
        'SELECT value FROM example WHERE key = 1 ORDER BY value'
    """

    def __init__(
        self,
        select: Union[str, AttrList],
        table: str,
        where: Optional[WhereQuery] = None,
        extra: Optional[str] = None,
    ) -> None:
        self.__select = select
        self.__table = table
        self.__where = where
        self.__extra = extra


        validate_table_name(self.__table)