晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
| DIR:/opt/hc_python/lib/python3.12/site-packages/mysql/connector/django/ |
| Current File : //opt/hc_python/lib/python3.12/site-packages/mysql/connector/django/features.py |
# MySQL Connector/Python - MySQL driver written in Python.
# New file added for Django 1.8
import django
if django.VERSION >= (1, 8):
from django.db.backends.base.features import BaseDatabaseFeatures
else:
from django.db.backends import BaseDatabaseFeatures
from django.utils.functional import cached_property
from django.utils import six
try:
import pytz
HAVE_PYTZ = True
except ImportError:
HAVE_PYTZ = False
class DatabaseFeatures(BaseDatabaseFeatures):
"""Features specific to MySQL
Microsecond precision is supported since MySQL 5.6.3 and turned on
by default if this MySQL version is used.
"""
empty_fetchmany_value = []
update_can_self_select = False
allows_group_by_pk = True
related_fields_match_type = True
allow_sliced_subqueries = False
has_bulk_insert = True
has_select_for_update = True
has_select_for_update_nowait = False
supports_forward_references = False
supports_regex_backreferencing = False
supports_date_lookup_using_string = False
can_introspect_autofield = True
can_introspect_binary_field = False
can_introspect_small_integer_field = True
supports_timezones = False
requires_explicit_null_ordering_when_grouping = True
allows_auto_pk_0 = False
allows_primary_key_0 = False
uses_savepoints = True
atomic_transactions = False
supports_column_check_constraints = False
if django.VERSION < (1, 8):
supports_long_model_names = False
supports_binary_field = six.PY2
can_introspect_boolean_field = False
def __init__(self, connection):
super(DatabaseFeatures, self).__init__(connection)
@cached_property
def supports_microsecond_precision(self):
if self.connection.mysql_version >= (5, 6, 3):
return True
return False
@cached_property
def mysql_storage_engine(self):
"""Get default storage engine of MySQL
This method creates a table without ENGINE table option and inspects
which engine was used.
Used by Django tests.
"""
tblname = 'INTROSPECT_TEST'
droptable = 'DROP TABLE IF EXISTS {table}'.format(table=tblname)
with self.connection.cursor() as cursor:
cursor.execute(droptable)
cursor.execute('CREATE TABLE {table} (X INT)'.format(table=tblname))
if self.connection.mysql_version >= (5, 0, 0):
cursor.execute(
"SELECT ENGINE FROM INFORMATION_SCHEMA.TABLES "
"WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s",
(self.connection.settings_dict['NAME'], tblname))
engine = cursor.fetchone()[0]
else:
# Very old MySQL servers..
cursor.execute("SHOW TABLE STATUS WHERE Name='{table}'".format(
table=tblname))
engine = cursor.fetchone()[1]
cursor.execute(droptable)
self._cached_storage_engine = engine
return engine
@cached_property
def _disabled_supports_transactions(self):
return self.mysql_storage_engine == 'InnoDB'
@cached_property
def can_introspect_foreign_keys(self):
"""Confirm support for introspected foreign keys
Only the InnoDB storage engine supports Foreigen Key (not taking
into account MySQL Cluster here).
"""
return self.mysql_storage_engine == 'InnoDB'
@cached_property
def has_zoneinfo_database(self):
"""Tests if the time zone definitions are installed
MySQL accepts full time zones names (eg. Africa/Nairobi) but rejects
abbreviations (eg. EAT). When pytz isn't installed and the current
time zone is LocalTimezone (the only sensible value in this context),
the current time zone name will be an abbreviation. As a consequence,
MySQL cannot perform time zone conversions reliably.
"""
# Django 1.6
if not HAVE_PYTZ:
return False
with self.connection.cursor() as cursor:
cursor.execute("SELECT 1 FROM mysql.time_zone LIMIT 1")
return cursor.fetchall() != []
def introspected_boolean_field_type(self, *args, **kwargs):
# New in Django 1.8
return 'IntegerField'
|