php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #55768
Patch make_resuming_pdo_oci_sessions revision 2011-09-27 08:15 UTC by mikhail dot v dot gavrilov at gmail dot com
revision 2011-09-27 06:01 UTC by mikhail dot v dot gavrilov at gmail dot com
revision 2011-09-26 08:33 UTC by mikhail dot v dot gavrilov at gmail dot com
revision 2011-09-26 08:31 UTC by mikhail dot v dot gavrilov at gmail dot com
revision 2011-09-23 13:30 UTC by mikhail dot v dot gavrilov at gmail dot com

Patch make_resuming_pdo_oci_sessions for PDO OCI Bug #55768

Patch version 2011-09-26 08:33 UTC

Return to Bug #55768 | Download this patch
This patch is obsolete

Obsoleted by patches:

This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: mikhail.v.gavrilov@gmail.com

Index: oci_driver.c
===================================================================
--- oci_driver.c	(revision 317201)
+++ oci_driver.c	(working copy)
@@ -141,12 +141,27 @@
 				case 12154:	/* ORA-12154: TNS:could not resolve service name */
 					strcpy(*pdo_err, "42S02");
 					break;
-
-				case 22:	/* ORA-00022: invalid session id */
-				case 1012:	/* ORA-01012: */
-				case 3113:	/* ORA-03133: end of file on communication channel */
-				case 604:
-				case 1041:
+				
+				case	22:	/* ORA-00022: invalid session id */
+				case   378:
+				case   602:
+				case   603:
+				case   604:
+				case   609:
+				case  1012:	/* ORA-01012: */
+				case  1033:
+				case  1041:
+				case  1043:
+				case  1089:
+				case  1090:
+				case  1092:
+				case  3113:	/* ORA-03133: end of file on communication channel */
+				case  3114:
+				case  3122:
+				case  3135:
+				case 12153:
+				case 27146:
+				case 28511:
 					/* consider the connection closed */
 					dbh->is_closed = 1;
 					H->attached = 0;
@@ -515,7 +530,25 @@
 
 }
 /* }}} */
+static int pdo_oci_check_liveness(pdo_dbh_t *dbh TSRMLS_DC)
+{
+	pdo_oci_db_handle *H = (pdo_oci_db_handle *)dbh->driver_data;
+	/* TODO move attached check to PDO level */
+	if (H->attached == 0) return FAILURE;
+	/* TODO add persistent_timeout check at PDO level */
 
+	
+#if ((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2)))	/* OCIPing available 10.2 onwards */
+	if (OCIPing (H->svc, H->err, OCI_DEFAULT) != OCI_SUCCESS) return FAILURE;
+#else
+	char version[256];
+	/* use good old OCIServerVersion() */
+	if (OCIServerVersion (H->svc, H->err, (text *)version, sizeof(version), OCI_HTYPE_SVCCTX) != OCI_SUCCESS) return FAILURE;
+#endif
+	return SUCCESS;
+}
+/* }}} */
+
 static struct pdo_dbh_methods oci_methods = {
 	oci_handle_closer,
 	oci_handle_preparer,
@@ -528,7 +561,7 @@
 	NULL,
 	pdo_oci_fetch_error_func,
 	oci_handle_get_attribute,
-	NULL,	/* check_liveness */
+	pdo_oci_check_liveness,	/* check_liveness */
 	NULL	/* get_driver_methods */
 };
 
@@ -675,6 +708,7 @@
 }
 /* }}} */
 
+
 /*
  * Local variables:
  * tab-width: 4
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 08:01:29 2024 UTC