新闻资讯
看你所看,想你所想

MySQLdb

MySQL是一个小型关系型数据库管理系统,开发者为瑞典MySQLAB公司。在2008年1月16号被Sun公司收购。目前MySQL被广泛地应用在Internet上的中小型网站中。由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,许多中小型网站为了降来自低网站总体拥有成本而360百科选择了MySQL作为网站数据库。

  • 中文名称 MySQLdb
  • 外文名称 无
  • 性质 小型关系型数据库管理系统,。
  • 开发者 为瑞典MySQLAB公司
  • Sun公司收购 在2008年1月16号

简介

MyS妒表缺却井防卷场企胶选QLdb

  Pyt来自hon 连接 MySQL 的模块。 MySQL versions 3.23-5.1; and Python versions 2.3-2.5 are supported.

Python

  Python是360百科一种编程语言,它的名字来源于一个喜剧。也许最初设计Python这种语言的人并没有想到见办百临反今天Python会在工业和科研上获得如此广泛的使用。著名的自由软件作者EricRaymond在他的文章《如何成为一名黑客》中,将Python列为黑客应当学习的四种编程语言之一,并建议人们从Python开始学习编程。这的确是一个中肯的建议,对于那些从来没有学习过编程或者并非计算机专业的编程学习者而言,Python是最好的选择之一。Python第一次学习Python,我只用了不地否到二十分钟的时间,站在书店里把一本教初学编程的人学习Python的书翻了一遍。也是从那时起,我开始被这种神奇的语言吸浓团展举将等溶引。

属性和方法

DATA

  BI训攻头促NARY = DBAPISet([249, 250, 251, 252])

  DATE = DBAPISet([10, 14])

  NULL = 'NULL'

  NUMBER = DBAPIS控根实车病物新夜单et([0, 1, 3, 4盾引罪复顾破高由, 5, 8, 9, 13])

  ROWID = DBAPISet([])

  STRING = DBAPISet([253, 助原掉树实起信分254, 247])

  TIME = DBAPISet([11])

  TIMESTAMP = DBAPISet([12, 7])

  __all__ = ['BINARY', 'Binary', 'Connect', 'C大容停之切款他onnection', 'DATE', 'Date'...

  __author__ = 'Andy Dus误必tman __revisi课饭酸矿席怕乡助on__ = '491'

  __version__ = '1.2.2'

  __warningregistry__ = {('the sets module is depre期裂响权cated', <ty就倍责再略pe 'except...

  apilevel = '2.0'

  params使面tyle = 'for倍物异mat'

  threadsafety = 1

  version_info = (1, 2, 2, 'final', 0)

FUNCTIONS

  Binary(x)

  Connect(*args, **kwargs)

  Factory function for connections.Connection.

  Connection = Connect(*args, **kwargs)

  Factory function for connections.Connection.

  DateFr南纸士omTicks(tick物促院直则本s)

  Convert UNIX ticks into a date instance.

  TimeFromTicks(ticks)

  Convert UNIX ticks into a time instance.

  TimestampFromTicks(ticks)

  Convert UNIX ticks into a datetime instance.

  connect = Connect(*args, **kwargs)

  Factory function for connections.Connection.

  debug(...)

  Does a DBUG_PUSH with the given string.

  mysql_debug() uses the Fred Fish debug library.

  To use this function, you must compile the client library to

  support debugging.

  escape(...)

  escape(obj, dict) -- escape any special characters in object obj

  using mapping dict to provide quoting functions for each type.

  Returns a SQL literal string.

  escape_dict(...)

  escape_sequence(d, dict) -- escape any special characters in

  dictionary d using mapping dict to provide quoting functions for each type.

  Returns a dictionary of escaped items.

  escape_sequence(...)

  escape_sequence(seq, dict) -- escape any special characters in sequence

  seq using mapping dict to provide quoting functions for each type.

  Returns a tuple of escaped items.

  escape_string(...)

  escape_string(s) -- quote any SQL-interpreted characters in string s.

  Use connection.escape_string(s), if you use it at all.

  _mysql.escape_string(s) cannot handle character sets. You are

  probably better off using connection.escape(o) instead, since

  it will escape entire sequences as well as strings.

  get_client_info(...)

  get_client_info() -- Returns a string that represents

  the client library version.

  string_literal(...)

  string_literal(obj) -- converts object obj into a SQL string literal.

  This means, any special SQL characters are escaped, and it is enclosed

  within single quotes. In other words, it performs:

  "'%s'" % escape_string(str(obj))

简单使用

  现在我们来插入几行数据到数据库, 然后再将它们取出来:

更多帮助

  更多内容参见Python在线帮助文档

  >>>help()

  help>MySQLdb

转载请注明出处安可林文章网 » MySQLdb

相关推荐

    声明:此文信息来源于网络,登载此文只为提供信息参考,并不用于任何商业目的。如有侵权,请及时联系我们:fendou3451@163.com