Существует ли стандартная библиотека объединения подключения mysql для C?

Встроенные методы или функции не реализуют протокол дескриптора, который лишает возможности делать материал как это:

>>> class C(object):
...  id = id
... 
>>> C().id()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: id() takes exactly one argument (0 given)

Однако можно создать маленькое, связывают дескриптор, который делает это возможным:

>>> from types import MethodType
>>> class bind(object):
...  def __init__(self, callable):
...   self.callable = callable
...  def __get__(self, obj, type=None):
...   if obj is None:
...    return self
...   return MethodType(self.callable, obj, type)
... 
>>> class C(object):
...  id = bind(id)
... 
>>> C().id()
7414064
5
задан Kieran Tully 23 July 2009 в 17:12
поделиться

1 ответ

The Zild Database Library, "a thread-safe high level multi-database connection pool library", looks very promising.

Previously I suggested that SQL Relay could be used to do this, amongst many other useful things, such as

  • client-side caching
  • load-balancing across database instances
  • translating between different database access APIs

If the MySQL library is dynamically linked this can be done without recompiling the application.

When I last looked in 2009, the mailing list suggested SQL Relay might not be fully ready for production use, but that appears to have changed.

4
ответ дан 15 December 2019 в 01:08
поделиться
Другие вопросы по тегам:

Похожие вопросы: