예제 #1
0
def Thing2Literal(o, d):
    """Convert something into a SQL string literal.  If using
    MySQL-3.23 or newer, string_literal() is a method of the
    _mysql.MYSQL object, and this function will be overridden with
    that method when the connection is created."""

    return string_literal(o, d)
예제 #2
0
def Thing2Literal(o, d):
    """Convert something into a SQL string literal.  If using
    MySQL-3.23 or newer, string_literal() is a method of the
    _mysql.MYSQL object, and this function will be overridden with
    that method when the connection is created."""

    return string_literal(o, d)
예제 #3
0
파일: times.py 프로젝트: edelooff/newWeb
def DateTimeToLiteral(date, converter):
  """Format a DateTime object as an ISO timestamp."""
  try:
    date = date.astimezone(pytz.utc)
  except ValueError:
    pass  # naive datetime object
  return _mysql.string_literal(date.isoformat(), converter)
예제 #4
0
파일: base.py 프로젝트: nischu7/django
def adapt_datetime_with_timezone_support(value, conv):
    # Equivalent to DateTimeField.get_db_prep_value. Used only by raw SQL.
    if settings.USE_TZ:
        if timezone.is_naive(value):
            warnings.warn(u"SQLite received a naive datetime (%s)"
                          u" while time zone support is active." % value,
                          RuntimeWarning)
            default_timezone = timezone.get_default_timezone()
            value = timezone.make_aware(value, default_timezone)
        value = value.astimezone(timezone.utc).replace(tzinfo=None)
    return string_literal(value.strftime("%Y-%m-%d %H:%M:%S"), conv)
예제 #5
0
파일: CURD.py 프로젝트: sirithink/CURD.py
 def time2str(data):
     return string_literal(data.strftime('%H:%M:%S'))
예제 #6
0
파일: CURD.py 프로젝트: sirithink/CURD.py
 def datetime2str(data):
     return string_literal(data.strftime('%Y-%m-%d %H:%M:%S'))
예제 #7
0
파일: CURD.py 프로젝트: sirithink/CURD.py
 def thing2str(data):
     return string_literal(data)
예제 #8
0
def _escape_string(s, d):
    return _mysql.string_literal(s.encode('utf-8'), d).decode('utf-8')
예제 #9
0
def _escape_bytes(b, c):
    return _mysql.string_literal(b, c).decode('utf-8')
예제 #10
0
파일: times.py 프로젝트: edelooff/newWeb
def TimeDeltaToLiteral(timedelta, converter):
  """Formats a DateTimeDelta object as a string-literal time delta."""
  hours, seconds = divmod(timedelta.seconds, 3600)
  minutes, seconds = divmod(seconds, 60)
  literal = '%d %d:%d:%d' % (timedelta.days, hours, minutes, seconds)
  return _mysql.string_literal(literal, converter)
예제 #11
0
def Set2Str(s, d):
    # Only support ascii string.  Not tested.
    return string_literal(','.join(s), d)
예제 #12
0
 def my_dict_escape(*args):
     from _mysql import string_literal, escape_string
     return ','.join([
         '%s=%s' % (escape_string(k), string_literal(v))
         for k, v in args[0].items()
     ])
예제 #13
0
def Set_to_sql(value, conv):
    """Convert a Python xet to an SQL literal."""
    return string_literal(','.join(value), conv)
예제 #14
0
def timedelta_to_sql(obj, conv):
    """Format a timedelta as an SQL literal."""
    return string_literal(timedelta_to_str(obj), conv)
예제 #15
0
파일: times.py 프로젝트: ThomRosario/as
def DateTimeDelta2literal(d, c):
    """Format a DateTimeDelta object as a time."""
    return string_literal(format_TIME(d),c)
예제 #16
0
def DateTimeDelta2literal(d, c):
    """Format a DateTimeDelta object as a time."""
    return string_literal(format_TIMEDELTA(d), c)
예제 #17
0
파일: times.py 프로젝트: edelooff/newWeb
def TimeStructToLiteral(date, converter):
  """Formats a time_struct as an ISO timestamp."""
  return _mysql.string_literal(time.strftime('%FT%T', date), converter)
예제 #18
0
def datetime_to_sql(obj, conv):
    """Format a DateTime object as an ISO timestamp."""
    return string_literal(datetime_to_str(obj), conv)
예제 #19
0
 def thing2str(data):
     return string_literal(data)
예제 #20
0
def Set2Str(s, d):
    # Only support ascii string.  Not tested.
    return string_literal(','.join(s), d)
예제 #21
0
 def unicode2str(data):
     return string_literal(data.encode(DATA_ENCODING))
예제 #22
0
파일: CURD.py 프로젝트: sirithink/CURD.py
 def unicode2str(data):
     return string_literal(data.encode(DATA_ENCODING))
예제 #23
0
 def datetime2str(data):
     return string_literal(data.strftime('%Y-%m-%d %H:%M:%S'))
예제 #24
0
파일: CURD.py 프로젝트: sirithink/CURD.py
 def date2str(data):
     return string_literal(data.strftime('%Y-%m-%d'))
예제 #25
0
 def date2str(data):
     return string_literal(data.strftime('%Y-%m-%d'))
예제 #26
0
파일: CURD.py 프로젝트: sirithink/CURD.py
 def timedelta2str(data):
     seconds = int(data.seconds) % 60
     minutes = int(data.seconds / 60) % 60
     hours = int(data.seconds / 3600) % 24
     return string_literal('%d %d:%d:%d' % (data.days, hours, minutes, seconds))
예제 #27
0
 def time2str(data):
     return string_literal(data.strftime('%H:%M:%S'))
예제 #28
0
def Set2Str(s, d):
    return string_literal(','.join(s), d)
예제 #29
0
 def timedelta2str(data):
     seconds = int(data.seconds) % 60
     minutes = int(data.seconds / 60) % 60
     hours = int(data.seconds / 3600) % 24
     return string_literal('%d %d:%d:%d' %
                           (data.days, hours, minutes, seconds))
예제 #30
0
파일: times.py 프로젝트: ThomRosario/as
def DateTime2literal(d, c):
    """Format a DateTime object as an ISO timestamp."""
    return string_literal(format_TIMESTAMP(d),c)
예제 #31
0
 def string_literal(self, obj, dummy=None):
     return origmysqlc.string_literal(obj)
예제 #32
0
def DateTime2literal(d, c):
    """Format a DateTime object as an ISO timestamp."""
    return string_literal(format_TIMESTAMP(d), c)
예제 #33
0
파일: coromysql.py 프로젝트: rtyler/gogreen
	def string_literal(self, obj, dummy=None):
		return origmysqlc.string_literal(obj)
예제 #34
0
def Set2Str(s, d):
    return string_literal(','.join(s), d)
예제 #35
0
def _escape_bytes(b, c):
    return _mysql.string_literal(b, c).decode('utf-8')
예제 #36
0
def _escape_string(s, d):
    return _mysql.string_literal(s.encode('utf-8'), d).decode('utf-8')
예제 #37
0
 def unicode2str(data):
     return string_literal(data.encode(Compiler.encoding))