CVS update: php3/functions

From: Date: Mon, 19 Apr 1999 19:08:40 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-5140@lists.php.net to get a copy of this message
Date: Monday April 19, 1999 @ 15:08 Author: thies Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv15948/functions Modified Files: oci8.c php3_oci8.h Log Message: some more work on transactions (oci8 is like sendmail.cf -> very flexible but ....;-) Index: php3/functions/oci8.c diff -c php3/functions/oci8.c:1.80 php3/functions/oci8.c:1.81 *** php3/functions/oci8.c:1.80 Mon Apr 19 09:59:16 1999 --- php3/functions/oci8.c Mon Apr 19 15:08:40 1999 *************** *** 33,39 **** #define OCI8_USE_EMALLOC 0 /* set this to 1 if you want to use the php memory manager! */ ! /* $Id: oci8.c,v 1.80 1999/04/19 13:59:16 thies Exp $ */ /* TODO list: * --- 33,39 ---- #define OCI8_USE_EMALLOC 0 /* set this to 1 if you want to use the php memory manager! */ ! /* $Id: oci8.c,v 1.81 1999/04/19 19:08:40 thies Exp $ */ /* TODO list: * *************** *** 219,225 **** void php3_oci8_loaddesc(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_commit(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_rollback(INTERNAL_FUNCTION_PARAMETERS); ! void php3_oci8_transstart(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_newdescriptor(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_numcols(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_parse(INTERNAL_FUNCTION_PARAMETERS); --- 219,226 ---- void php3_oci8_loaddesc(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_commit(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_rollback(INTERNAL_FUNCTION_PARAMETERS); ! void php3_oci8_newtrans(INTERNAL_FUNCTION_PARAMETERS); ! void php3_oci8_settrans(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_newdescriptor(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_numcols(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_parse(INTERNAL_FUNCTION_PARAMETERS); *************** *** 269,275 **** {"ociloaddesc", php3_oci8_loaddesc, NULL}, {"ocicommit", php3_oci8_commit, NULL}, {"ocirollback", php3_oci8_rollback, NULL}, ! {"ocitransstart", php3_oci8_transstart, NULL}, {"ocinewdescriptor", php3_oci8_newdescriptor, NULL}, {NULL, NULL, NULL} }; --- 270,277 ---- {"ociloaddesc", php3_oci8_loaddesc, NULL}, {"ocicommit", php3_oci8_commit, NULL}, {"ocirollback", php3_oci8_rollback, NULL}, ! {"ocinewtransaction",php3_oci8_newtrans, NULL}, ! {"ocisettransaction",php3_oci8_settrans, NULL}, {"ocinewdescriptor", php3_oci8_newdescriptor, NULL}, {NULL, NULL, NULL} }; *************** *** 2039,2044 **** --- 2041,2061 ---- goto CLEANUP; } + OCIAttrSet((dvoid *)session->server->pServer, + OCI_HTYPE_SERVER, + (dvoid *) "demo", + 0, + OCI_ATTR_EXTERNAL_NAME, + connection->pError); + + OCIAttrSet((dvoid *)session->server->pServer, + OCI_HTYPE_SERVER, + (dvoid *) "txn demo2", + 0, + OCI_ATTR_INTERNAL_NAME, + connection->pError); + + connection->id = php3_list_insert(connection, OCI8_GLOBAL(php3_oci8_module).le_conn); connection->descriptors = emalloc(sizeof(HashTable)); if (!connection->descriptors || *************** *** 2475,2489 **** add_method(return_value, "free", php3_oci8_freedesc); } /* }}} */ ! /* {{{ proto string OCITransStart(int conn [, int timeout] [, int flags] ) ! rollback the current context */ ! void php3_oci8_transstart(INTERNAL_FUNCTION_PARAMETERS) { pval *conn; oci8_connection *connection; sword ociresult; OCI8_TLS_VARS; --- 2492,2514 ---- add_method(return_value, "free", php3_oci8_freedesc); } + /* }}} */ + /* {{{ proto string OCINewTrans(int conn, string name) + */ + + void php3_oci8_settrans(INTERNAL_FUNCTION_PARAMETERS) + { + } + /* }}} */ ! /* {{{ proto string OCINewTrans(int conn, string name) */ ! void php3_oci8_newtrans(INTERNAL_FUNCTION_PARAMETERS) { pval *conn; oci8_connection *connection; + oci8_xa *trans; sword ociresult; OCI8_TLS_VARS; *************** *** 2492,2502 **** } convert_to_long(conn); ! connection = oci8_get_conn(conn->value.lval, "OCITransStart", list); if (connection == NULL) { RETURN_FALSE; } /* Specifies whether a new transaction is being started or an existing transaction is being resumed. Also specifies serializiability or read-only status. More than a single value can be specified. By default, a read/write transaction is started. The flag values are: --- 2517,2588 ---- } convert_to_long(conn); ! connection = oci8_get_conn(conn->value.lval, "OCINewTrans", list); if (connection == NULL) { RETURN_FALSE; } + trans = (oci8_xa *) ecalloc(1,sizeof(oci8_xa)); + + ociresult = OCIHandleAlloc(OCI8_GLOBAL(php3_oci8_module).pEnv, + (dvoid **) &trans->pTrans, + OCI_HTYPE_TRANS, + 0, + 0); + + if (ociresult) { + oci8_error(connection->pError, "php3_oci8_newtrans OCIHandleAlloc OCI_HTYPE_TRANS", ociresult); + RETURN_FALSE; + } + + ociresult = OCIAttrSet((dvoid *) connection->pServiceContext, + OCI_HTYPE_SVCCTX, + (dvoid *)trans->pTrans, + 0, + OCI_ATTR_TRANS, + connection->pError); + + if (ociresult) { + oci8_error(connection->pError, "php3_oci8_newtrans OCIAttrSet OCI_ATTR_TRANS", ociresult); + RETURN_FALSE; + } + + #if 0 + trans->xid.formatID = -1; /* format id = 1000 */ + trans->xid.gtrid_length = 1; /* gtrid = 123 */ + trans->xid.data[0] = 0; + trans->xid.data[1] = 2; + trans->xid.data[2] = 3; + trans->xid.bqual_length = 1; /* bqual = 2 */ + trans->xid.data[3] = 0; + + ociresult = OCIAttrSet((dvoid *)trans->pTrans, + OCI_HTYPE_TRANS, + (dvoid *)&trans->xid, + sizeof(XID), + OCI_ATTR_XID, + connection->pError); + + if (ociresult) { + oci8_error(connection->pError, "php3_oci8_newtrans OCIAttrSet OCI_ATTR_XID", ociresult); + RETURN_FALSE; + } + + strcpy(trans->xname,"hallo"); + + ociresult = OCIAttrSet((dvoid *)trans->pTrans, + OCI_HTYPE_TRANS, + (dvoid *)&trans->xname, + strlen(trans->xname), + OCI_ATTR_TRANS_NAME, + connection->pError); + if (ociresult) { + oci8_error(connection->pError, "php3_oci8_newtrans OCIAttrSet OCI_ATTR_XID", ociresult); + RETURN_FALSE; + } + + #endif + /* Specifies whether a new transaction is being started or an existing transaction is being resumed. Also specifies serializiability or read-only status. More than a single value can be specified. By default, a read/write transaction is started. The flag values are: *************** *** 2509,2515 **** OCI_TRANS_SERIALIZABLE - start a serializable transaction */ ! ociresult = OCITransStart(connection->pServiceContext,connection->pError, (uword)60,(ub4) OCI_TRANS_NEW); oci8_debug("OCITransStart=%d",ociresult); --- 2595,2604 ---- OCI_TRANS_SERIALIZABLE - start a serializable transaction */ ! ociresult = OCITransStart(connection->pServiceContext, ! connection->pError, ! (uword) 60, ! (ub4) OCI_TRANS_NEW); oci8_debug("OCITransStart=%d",ociresult); Index: php3/functions/php3_oci8.h diff -c php3/functions/php3_oci8.h:1.39 php3/functions/php3_oci8.h:1.40 *** php3/functions/php3_oci8.h:1.39 Mon Apr 19 09:43:15 1999 --- php3/functions/php3_oci8.h Mon Apr 19 15:08:40 1999 *************** *** 49,55 **** # endif # endif /* osf alpha */ ! # include <oci.h> typedef struct { int num; --- 49,56 ---- # endif # endif /* osf alpha */ ! #include <oci.h> ! #include <xa.h> typedef struct { int num; *************** *** 81,86 **** --- 82,93 ---- } oci8_connection; typedef struct { + int id; + oci8_session *session; + OCITrans *pTrans; + } oci8_xa; + + typedef struct { dvoid *ocidescr; ub4 type; } oci8_descriptor; *************** *** 152,157 **** --- 159,165 ---- int le_conn; /* active connections */ int le_stmt; /* active statements */ + int le_trans; /* active transactions */ int server_num; HashTable *server; -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5140) next »