Trees | Indices | Help |
---|
|
object --+ | connection
Returns a CUBRID connection object.
|
|||
|
|||
a new object with type S, a subtype of T |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
autocommit autocommit status |
|||
isolation_level isolation level |
|||
lock_timeout lock time out |
|||
max_string_len max string length |
|||
Inherited from |
|
x.__init__(...) initializes x; see help(type(x)) for signature
|
|
repr(x)
|
This function returns a string that represents the client library version. Return a string that represents the CUBRID client library Example: import _cubrid con = _cubrid.connect("CUBRID:localhost:33000:demodb:::", "public") print con.client_version() con.close() |
Commit any pending transaction to the database. CUBRID can be set to perform automatic commits at each operation, set_autocommit() and set_isolation_level(). |
Get the cursor class. Return a new Cursor Object. Example: import _cubrid con = _cubrid.connect("CUBRID:localhost:33000:demodb:::", "public") cur = con.cursor() ... other operations ... cur.close() con.close() |
This function returns the value with the IDs generated or the AUTO_INCREMENT columns that were updated by the previous INSERT query. It returns None if the previous query does not generate new rows. Returns the value with the IDs generated for the AUTO_INCREMENT columns that were updated by the previous INSERT query. Example: import _cubrid con = _cubrid.connect("CUBRID:localhost:33000:demodb:::", "public") cur = con.curosr() cur.prepare("create table test_cubrid(id NUMERIC AUTO_INCREMENT(10300, 1), name VARCHAR(50))") cur.execute() cur.prepare("insert into test_cubrid(name) values ('Lily')") cur.execute() print con.insert_id() cur.close() con.close() |
Create a large object. Return a new lob object. Example: import _cubrid con = _cubrid.connect("CUBRID:localhost:33000:demodb:::", "public") cur = con.cursor() cur.prepare('insert into test_lob(image) values (?)') lob = con.lob() lob.imports('123.jpg') cur.bind_lob(1, lob) cur.execute() lob.close() cur.close() con.close() |
Checks whether or not the connection to the server is working. This function can be used by clients that remain idle for a long while, to check whether or not the server has closed the connection and reconnect if necessary. Return values: 1 when connected 0 when not connect Example: import _cubrid con = _cubrid.connect("CUBRID:localhost:33000:demodb:::", "public") print con.ping() con.close() |
Roll back the start of any pending transaction to database. Closing a connection without committing the changes first will cause an implicit rollback to be performed. |
This function is used to get the requested schema information from database. You have to designate class_name, if you want to get information on certain class, attr_name, if you want to get information on certain attribute (can be used only with CUBRID_SCH_COLUMN_PRIVILEGE). The following tables shows types of schema and the column structure of the result: ---------------------------------------------------------------------- Schema Col Number Col Name Value ---------------------------------------------------------------------- CUBRID_SCH_TABLE 1 NAME 2 TYPE 0:system table 1:viem 2:table ---------------------------------------------------------------------- CUBRID_SCH_VIEW 1 NAME 2 TYPE 1:view ---------------------------------------------------------------------- CUBRID_SCH_QUERY_SPEC 1 QUERY_SPEC ---------------------------------------------------------------------- CUBRID_SCH_ATTRIBUTE 1 ATTR_NAME CUBRID_SCH_TABLE_ATTRIBUTE 2 DOMAIN 3 SCALE 4 PRECISION 5 INDEXED 1:indexed 6 NOT NULL 1:not null 7 SHARED 1:shared 8 UNIQUE 1:uniqe 9 DEFAULT 10 ATTR_ORDER 1:base 11 TABLE_NAME 12 SOURCE_CLASS 13 IS_KEY 1:key ---------------------------------------------------------------------- CUBRID_SCH_METHOD 1 NAME CUBRID_SCH_TABLE_METHOD 2 RET_DOMAIN 3 ARG_DOMAIN ---------------------------------------------------------------------- CUBRID_SCH_METHOD_FILE 1 METHOD_FILE ---------------------------------------------------------------------- CUBRID_SCH_SUPERTABLE 1 TABLE_NAME CUBRID_SCH_SUBTABLE 2 TYPE 0:system table CUBRID_SCH_DIRECT_SUPER_TABLE 1:view 2:table ---------------------------------------------------------------------- CUBRID_SCH_CONSTRAINT 1 TYPE 0:unique 1:index 2:reverse unique 3:reverse index 2 NAME 3 ATTR_NAME 4 NUM_PAGES 5 NUM_KEYS 6 PRIMARY_KEY 1:primary key 7 KEY_ORDER 1:base ---------------------------------------------------------------------- CUBRID_SCH_TRIGGER 1 NAME 2 STATUS 3 EVENT 4 TARGET_TABLE 5 TARGET_ATTR 6 ACTION_TIME 7 ACTION 8 PRIORITY 9 CONDITION_TIME 10 CONDITION ---------------------------------------------------------------------- CUBRID_SCH_TABLE_PRIVILEGE 1 TABLE_NAME 2 PRIVILEGE 3 GRANTABLE ---------------------------------------------------------------------- CCI_SCH_ATTR_PRIVILEGE 1 ATTR_NAME 2 PRIVILEGE 3 GRANTABLE ---------------------------------------------------------------------- CUBRID_SCH_PRIMARY_KEY 1 TABLE_NAME 2 ATTR_NAME 3 KEY_SEQ 1:base 4 KEY_NAME ---------------------------------------------------------------------- CUBRID_SCH_IMPORTED_KEYS 1 PKTABLE_NAME CUBRID_SCH_EXPORTED_KEYS 2 PKCOLUMN_NAME CUBRID_SCH_CROSS_REFERENCE 3 FKTABLE_NAME 1:base 4 FKCOLUMN_NAME 5 KEY_SEQ 6 UPDATE_ACTION 0:cascade 1:restrict 2:no action 3:set null 7 DELETE_ACTION 0:cascade 1:restrict 2:no action 3:set null 8 FK_NAME 9 PK_NAME ---------------------------------------------------------------------- Parameters: schema_type: schema type in the table table_name: string, table you want to know the schema of attr_name: string, attribute you want to know the schema of Return values: A tuple that contains the schema information when success None when fail Example: import _cubrid con = _cubrid.connect('CUBRID:localhost:33000:demodb:::', 'public') print con.schema_info(_cubrid.CUBRID_SCH_TABLE, 'test_cubrid') con.close() |
This function returns a string that represents the CUBRID server version. Returns a string that represents the server version number. Example: import _cubrid con = _cubrid.connect("CUBRID:localhost:33000:demodb:::", "public") print con.server_version() con.close() |
Create a LIST/SET/MULTISET object. Return a new LIST/SET/MULTISET object. Example:: con = _cubrid.connect('CUBRID:localhost:30000:demodb:dba::') c = con.cursor() s = con.set() value = ('1','2') s.imports(value ,CUBRIDdb.CCI_U_TYPE_INT) c.prepare('''INSERT INTO set_tbl_int VALUES(?);''') c.bind_set(1,s) c.execute() con.commit() c.close() con.close() |
This function set the autocommit mode. It can enable/disable the transaction management. mode: bool. It will be True/False Example: import _cubrid con = _cubrid.connect("CUBRID:localhost:33000:demodb:::", "public") con.set_autocommit(True) print con.autocommit con.close() |
Set the transaction isolation level for the current session. The level defines the different phenomena can happen in the database between concurrent transactions. isolation_level maybe: CUBRID_COMMIT_CLASS_UNCOMMIT_INSTANCE CUBRID_COMMIT_CLASS_COMMIT_INSTANCE CUBRID_REP_CLASS_UNCOMMIT_INSTANCE CUBRID_REP_CLASS_COMMIT_INSTANCE CUBRID_REP_CLASS_REP_INSTANCE CUBRID_SERIALIZABLE Example: import _cubrid form _cubrid import * con = _cubrid.connect("CUBRID:localhost:33000:demodb:::", "public") con.set_isolation_level(CUBRID_REP_CLASS_REP_INSTANCE) print con.isolation_level con.close() |
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Mar 28 11:44:57 2014 | http://epydoc.sourceforge.net |