Package orm2 :: Package adapters :: Package mysql :: Module datasource :: Class datasource
[hide private]
[frames] | no frames]

Class datasource

source code

        sql.datasource --+    
                         |    
datasource.datasource_base --+
                             |
                            datasource

Instance Methods [hide private]
  __init__(self, **kwargs)
This constructor accepts all those keyword args the MySQL module's connect function knows about.
  _from_params(params)
Construct a mysql datasource object from an orm connection string.
  identifyer_quotes(self, name)
  backend_encoding(self)
  select_after_insert_where(self, dbobj)

Inherited from datasource.datasource_base: close, commit, count, cursor, delete_by_primary_key, execute, flush_updates, insert, join_select, primary_key_where, query_one, rollback, run_select, select, select_after_insert, select_by_primary_key, select_for_update, select_one, update, update_cursor

Inherited from datasource.datasource_base (private): _dbconn

Inherited from sql.datasource: escape_string, string_quotes


Static Methods [hide private]
  from_params(params)
Construct a mysql datasource object from an orm connection string.

Class Variables [hide private]
  escaped_chars = (('"', '\\"'), ("'", '\\"'), ('%', '%%'))
  encodings = {'estonia': 'iso8859-13', 'czech': 'iso8859-2', 'gbk...

Inherited from datasource.datasource_base (private): _format_funcs


Method Details [hide private]

__init__(self, **kwargs)
(Constructor)

source code 

This constructor accepts all those keyword args the MySQL module's connect function knows about. They're passed on 'as is'.

The only exception is 'encoding' which lets you determine which encoding orm uses to send data to the backend. It defaults to utf-8. The set_character_set() function is used on the database connection to set this. Encodings must be referred to by their MySQL name.

From the MySQL-Python documentation:

Create a connection to the database. It is strongly recommended that you only use keyword parameters. 'NULL pointer' indicates that NULL will be passed to mysql_real_connect(); the value in parenthesis indicates how MySQL interprets the NULL. Consult the MySQL C API documentation for more information.
  • host -- string, host to connect to or NULL pointer (localhost)
  • user -- string, user to connect as or NULL pointer (your username)
  • passwd -- string, password to use or NULL pointer (no password)
  • db -- string, database to use or NULL (no DB selected)
  • port -- integer, TCP/IP port to connect to or default MySQL port
  • unix_socket -- string, location of unix_socket to use or use TCP
  • client_flags -- integer, flags to use or 0 (see MySQL docs)
  • conv -- conversion dictionary, see MySQLdb.converters
  • connect_time -- number of seconds to wait before the connection attempt fails.
  • compress -- if set, compression is enabled
  • 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()
  • cursorclass -- class object, used to create cursors or cursors.Cursor.
This parameter MUST be specified as a keyword parameter.
Overrides: datasource.datasource_base.__init__

_from_params(params)

source code 

Construct a mysql datasource object from an orm connection string.

A connection string for the mysql adapter may contain all keywords defined in orm2.datasource plus all those that are described as keyword parameters for __init__ above.

from_params(params)
Static Method

source code 

Construct a mysql datasource object from an orm connection string.

A connection string for the mysql adapter may contain all keywords defined in orm2.datasource plus all those that are described as keyword parameters for __init__ above.

identifyer_quotes(self, name)

source code 
None
Overrides: sql.datasource.identifyer_quotes

backend_encoding(self)

source code 
None
Overrides: sql.datasource.backend_encoding

select_after_insert_where(self, dbobj)

source code 
None
Overrides: datasource.datasource_base.select_after_insert_where

Class Variable Details [hide private]

escaped_chars

None
Value:
(('"', '\\"'), ("'", '\\"'), ('%', '%%'))                              
      

encodings

None
Value:
{'big5': 'big5',
 'cp1251': 'cp1251',
 'cp1257': 'cp1257',
 'cp866': 'cp866',
 'cp932': 'sjis',
 'croat': 'iso8859-2',
 'czech': 'iso8859-2',
 'danish': 'iso8859-1',
...