Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Module « MySQLdb »

Classe « connection »

Informations générales

Héritage

builtins.object
    connection

Définition

class connection(builtins.object):

Description [extrait de connection.__doc__]

Returns a MYSQL connection object. Exclusive use of
keyword parameters strongly recommended. Consult the
MySQL C API documentation for more details.

host
  string, host to connect

user
  string, user to connect as

passwd
  string, password to use

db
  string, database to use

port
  integer, TCP/IP port to connect to

unix_socket
  string, location of unix_socket (UNIX-ish only)

conv
  mapping, maps MySQL FIELD_TYPE.* to Python functions which
  convert a string to the appropriate Python type

connect_timeout
  number of seconds to wait before the connection
  attempt fails.

compress
  if set, gzip compression is enabled

named_pipe
  if set, connect to server via named pipe (Windows only)

init_command
  command which is run once the connection is created

read_default_file
  see the MySQL documentation for mysql_options()

read_default_group
  see the MySQL documentation for mysql_options()

client_flag
  client flags from MySQLdb.constants.CLIENT

load_infile
  int, non-zero enables LOAD LOCAL INFILE, zero disables

Constructeur(s)

Signature du constructeur Description
__new__(*args, **kwargs) Create and return a new object. See help(type) for accurate signature. [extrait de __new__.__doc__]
__init__(self, /, *args, **kwargs) Initialize self. See help(type(self)) for accurate signature. [extrait de __init__.__doc__]

Liste des attributs statiques

Nom de l'attribut Valeur
client_flag
converter
open
port
server_capabilities

Liste des opérateurs

Opérateurs hérités de la classe object

__eq__, __ge__, __gt__, __le__, __lt__, __ne__

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
__delattr__(self, name) Implement delattr(self, name). [extrait de __delattr__.__doc__]
__getattribute__(self, name) Return getattr(self, name). [extrait de __getattribute__.__doc__]
__repr__(self) Return repr(self). [extrait de __repr__.__doc__]
__setattr__(self, name, value) Implement setattr(self, name, value). [extrait de __setattr__.__doc__]
affected_rows Return number of rows affected by the last query. [extrait de affected_rows.__doc__]
autocommit Set the autocommit mode. True values enable; False value disable. [extrait de autocommit.__doc__]
change_user Changes the user and causes the database specified by db to [extrait de change_user.__doc__]
character_set_name Returns the default character set for the current connection. [extrait de character_set_name.__doc__]
close Close the connection. No further activity possible. [extrait de close.__doc__]
commit Commits the current transaction [extrait de commit.__doc__]
dump_debug_info Instructs the server to write some debug information to the [extrait de dump_debug_info.__doc__]
errno Returns the error code for the most recently invoked API function [extrait de errno.__doc__]
error Returns the error message for the most recently invoked API function [extrait de error.__doc__]
escape escape(obj, dict) -- escape any special characters in object obj [extrait de escape.__doc__]
escape_string escape_string(s) -- quote any SQL-interpreted characters in string s. [extrait de escape_string.__doc__]
field_count Returns the number of columns for the most recent query on the [extrait de field_count.__doc__]
fileno Return file descriptor of the underlying libmysqlclient connection. [extrait de fileno.__doc__]
get_autocommit Get the autocommit mode. True when enable; False when disable. [extrait de get_autocommit.__doc__]
get_character_set_info Returns a dict with information about the current character set: [extrait de get_character_set_info.__doc__]
get_host_info Returns a string that represents the MySQL client library [extrait de get_host_info.__doc__]
get_proto_info Returns an unsigned integer representing the protocol version [extrait de get_proto_info.__doc__]
get_server_info Returns a string that represents the server version number. [extrait de get_server_info.__doc__]
info Retrieves a string providing information about the most [extrait de info.__doc__]
insert_id Returns the ID generated for an AUTO_INCREMENT column by the previous [extrait de insert_id.__doc__]
kill Asks the server to kill the thread specified by pid. [extrait de kill.__doc__]
next_result If more query results exist, next_result() reads the next query [extrait de next_result.__doc__]
ping Checks whether or not the connection to the server is [extrait de ping.__doc__]
query Execute a query. store_result() or use_result() will get the [extrait de query.__doc__]
read_query_result Read result of query sent by send_query(). [extrait de read_query_result.__doc__]
rollback Rolls back the current transaction [extrait de rollback.__doc__]
select_db Causes the database specified by db to become the default [extrait de select_db.__doc__]
send_query Send a query. Same to query() except not wait response. [extrait de send_query.__doc__]
set_character_set Sets the default character set for the current connection. [extrait de set_character_set.__doc__]
set_server_option set_server_option(option) -- Enables or disables an option [extrait de set_server_option.__doc__]
shutdown Asks the database server to shut down. The connected user must [extrait de shutdown.__doc__]
sqlstate Returns a string containing the SQLSTATE error code [extrait de sqlstate.__doc__]
stat Returns a character string containing information similar to [extrait de stat.__doc__]
store_result Returns a result object acquired by mysql_store_result [extrait de store_result.__doc__]
string_literal string_literal(obj) -- converts object obj into a SQL string literal. [extrait de string_literal.__doc__]
thread_id Returns the thread ID of the current connection. This value [extrait de thread_id.__doc__]
use_result Returns a result object acquired by mysql_use_result [extrait de use_result.__doc__]
warning_count Returns the number of warnings generated during execution [extrait de warning_count.__doc__]

Méthodes héritées de la classe object

__dir__, __format__, __hash__, __init_subclass__, __reduce__, __reduce_ex__, __sizeof__, __str__, __subclasshook__