File: //opt/alt/python38/lib64/python3.8/site-packages/playhouse/__pycache__/sqlite_ext.cpython-38.pyc
U
S��W � @ sd d Z ddlZddlZddlZddlZddlZddlZddlZzddlZ W n e
k
rd ddl Z Y nX zddlmZ W n e
k
r� Y nX ddl
T ddl
mZ ddl
mZ ddl
mZ ddl
mZ dd l
mZ dd
l
mZ ddl
mZ ddl
mZ dd
l
mZ ddl
mZ ddl
mZ ddl
mZ zddlmZ W n e
k
�rN dZY nX ejd dk�rdeZdZ dZ!ej"dd� dk�r�d�p�dZ#dZ$G dd� de�Z%G dd� de�Z&G dd� de'�Z(G dd � d e)�Z*G d!d"� d"e+�Z,G d#d$� d$e-�Z.G d%d&� d&e.e+�Z/G d'd(� d(e.e0�Z1G d)d*� d*e.e2�Z3G d+d,� d,e.e4�Z5G d-d.� d.e6�Z7G d/d0� d0e7�Z8G d1d2� d2e8�Z9d3Z:e;d4d5d6d7e<d8�d9d:d;d<d=d>d?d@g
�e;dA�B e;e:�B e;e:�=� �B Z>e;dBdC� e?dD�D ��Z@e�AdE�ZBG dFdG� dGe8�ZCd]dHdI�ZDG dJdK� dKe�ZEejFdLdM�dNdO� �ZGG dPdQ� dQeH�ZIG dRdS� dSe�ZJdTe_KeI�LejKdUi� dVdT� ZMdWdX� ZNdYdZ� ZOd[d\� ZPdS )^a�
Sqlite3 extensions
==================
* Define custom aggregates, collations and functions
* Basic support for virtual tables
* Basic support for FTS3/4
* Specify isolation level in transactions
Example usage of the Full-text search:
class Document(FTSModel):
title = TextField() # type affinities are ignored in FTS
content = TextField()
Document.create_table(tokenize='porter') # use the porter stemmer
# populate the documents using normal operations.
for doc in documents:
Document.create(title=doc['title'], content=doc['content'])
# use the "match" operation for FTS queries.
matching_docs = Document.select().where(match(Document.title, 'some query'))
# to sort by best match, use the custom "rank" function.
best_docs = (Document
.select(Document, Document.rank('score'))
.where(match(Document.title, 'some query'))
.order_by(SQL('score')))
# or use the shortcut method.
best_docs = Document.match('some phrase')
� N)�
TableFunction)�*)�EnclosedClause)�Entity)�
Expression)�Node)�OP)�SqliteQueryCompiler)�_AutoPrimaryKeyField)�sqlite3)�transaction)�_sqlite_date_part)�_sqlite_date_trunc)�_sqlite_regexp)�_sqlite_ext� ZpcnalxZpcx)r � � ZFTS4ZFTS3)r � r c @ s e Zd ZdZdZdS )�
RowIDFieldz�
Field used to access hidden primary key on FTS5 or any other SQLite
table that does not have a separately-defined primary key.
�rowidN��__name__�
__module__�__qualname__�__doc__Z_column_name� r r �/sqlite_ext.pyr O s r c @ s e Zd ZdZdZdS )�
DocIDFieldz9Field used to access hidden primary key on FTS3/4 tables.�docidNr r r r r r W s r c s e Zd ZdZ� fdd�Z� ZS )�PrimaryKeyAutoIncrementFielda
SQLite by default uses MAX(primary key) + 1 to set the ID on a new row.
Using the `AUTOINCREMENT` field, the IDs will increase monotonically
even if rows are deleted. Use this if you need to guarantee IDs are not
re-used in the event of deletion.
c s t t| ��|�}|td�g S )NZ
AUTOINCREMENT)�superr �__ddl__�SQL)�selfZcolumn_typeZddl�� __class__r r r"