# 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
        if self.__where and not isinstance(where, (str, Where, And, Or)):
            raise TypeError(
                f"where should be a str/Where/And/Or instance: actual={type(self.__where)}"
            )

        if not self.__select:
            raise ValueError("SELECT query required")

    def to_query(self) -> str:
        query_list = [f"SELECT {self.__select}", f"FROM {Table(self.__table)}"]

        if self.__where:
            query_list.append(f"WHERE {self.__where}")
        if self.__extra:
            query_list.append(self.__extra)

        return " ".join(query_list)


class Insert(QueryItem):
    """
    INSERT query.

    :param str table: Table name of executing the query.
    :param AttrList attrs: Attributes that inserting to..
    :raises simplesqlite.NameValidationError:
        |raises_validate_table_name|
    """

    def __init__(self, table: str, attrs: AttrList) -> None:

# 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

        if self.__where and not isinstance(where, (str, Where, And, Or)):
            raise TypeError(
                f"where should be a str/Where/And/Or instance: actual={type(self.__where)}"
            )

        if not self.__select:
            raise ValueError("SELECT query required")

    def to_query(self) -> str:
        query_list = [f"SELECT {self.__select}", f"FROM {Table(self.__table)}"]

        if self.__where:
            query_list.append(f"WHERE {self.__where}")
        if self.__extra:
            query_list.append(self.__extra)

        return " ".join(query_list)


class Insert(QueryItem):
    """
    INSERT query.

    :param str table: Table name of executing the query.
    :param AttrList attrs: Attributes that inserting to..
    :raises simplesqlite.NameValidationError:
        |raises_validate_table_name|
    """

    def __init__(self, table: str, attrs: AttrList) -> None:

        validate_table_name(table)