Monotone-Parent: 19b4e678978ae5ff01c0325ba794ddcf84c944ba
Monotone-Revision: e06ea9bf29414e55d556171e1cc5c4a2d9c46894 Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-10-07T20:12:59 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
60fa280e71
commit
26ff424bfc
|
@ -34,6 +34,407 @@ Index: sope-ldap/NGLdap/ChangeLog
|
||||||
2009-04-02 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2009-04-02 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
* NGLdapConnection.m (useSSL,startTLS): new method enabling
|
* NGLdapConnection.m (useSSL,startTLS): new method enabling
|
||||||
|
Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.m
|
||||||
|
===================================================================
|
||||||
|
--- sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (revision 1660)
|
||||||
|
+++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (working copy)
|
||||||
|
@@ -713,6 +713,39 @@
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* GCSEOAdaptorChannel protocol */
|
||||||
|
+static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \
|
||||||
|
+ @" c_name VARCHAR (256) NOT NULL PRIMARY KEY,\n"
|
||||||
|
+ @" c_content VARCHAR (100000) NOT NULL,\n"
|
||||||
|
+ @" c_creationdate INT4 NOT NULL,\n"
|
||||||
|
+ @" c_lastmodified INT4 NOT NULL,\n"
|
||||||
|
+ @" c_version INT4 NOT NULL,\n"
|
||||||
|
+ @" c_deleted INT4 NULL\n"
|
||||||
|
+ @")");
|
||||||
|
+static NSString *sqlFolderACLFormat = (@"CREATE TABLE %@ (\n" \
|
||||||
|
+ @" c_uid VARCHAR (256) NOT NULL,\n"
|
||||||
|
+ @" c_object VARCHAR (256) NOT NULL,\n"
|
||||||
|
+ @" c_role VARCHAR (80) NOT NULL\n"
|
||||||
|
+ @")");
|
||||||
|
+
|
||||||
|
+- (NSException *) createGCSFolderTableWithName: (NSString *) tableName
|
||||||
|
+{
|
||||||
|
+ NSString *sql;
|
||||||
|
+
|
||||||
|
+ sql = [NSString stringWithFormat: sqlFolderFormat, tableName];
|
||||||
|
+
|
||||||
|
+ return [self evaluateExpressionX: sql];
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+- (NSException *) createGCSFolderACLTableWithName: (NSString *) tableName
|
||||||
|
+{
|
||||||
|
+ NSString *sql;
|
||||||
|
+
|
||||||
|
+ sql = [NSString stringWithFormat: sqlFolderACLFormat, tableName];
|
||||||
|
+
|
||||||
|
+ return [self evaluateExpressionX: sql];
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
@end /* PostgreSQL72Channel */
|
||||||
|
|
||||||
|
@implementation PostgreSQL72Channel(PrimaryKeyGeneration)
|
||||||
|
Index: sope-gdl1/MySQL/MySQL4Channel.m
|
||||||
|
===================================================================
|
||||||
|
--- sope-gdl1/MySQL/MySQL4Channel.m (revision 1660)
|
||||||
|
+++ sope-gdl1/MySQL/MySQL4Channel.m (working copy)
|
||||||
|
@@ -755,6 +755,39 @@
|
||||||
|
return pkey;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* GCSEOAdaptorChannel protocol */
|
||||||
|
+static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \
|
||||||
|
+ @" c_name VARCHAR (256) NOT NULL PRIMARY KEY,\n"
|
||||||
|
+ @" c_content VARCHAR (100000) NOT NULL,\n"
|
||||||
|
+ @" c_creationdate INT NOT NULL,\n"
|
||||||
|
+ @" c_lastmodified INT NOT NULL,\n"
|
||||||
|
+ @" c_version INT NOT NULL,\n"
|
||||||
|
+ @" c_deleted INT NULL\n"
|
||||||
|
+ @")");
|
||||||
|
+static NSString *sqlFolderACLFormat = (@"CREATE TABLE %@ (\n" \
|
||||||
|
+ @" c_uid VARCHAR (256) NOT NULL,\n"
|
||||||
|
+ @" c_object VARCHAR (256) NOT NULL,\n"
|
||||||
|
+ @" c_role VARCHAR (80) NOT NULL\n"
|
||||||
|
+ @")");
|
||||||
|
+
|
||||||
|
+- (NSException *) createGCSFolderTableWithName: (NSString *) tableName
|
||||||
|
+{
|
||||||
|
+ NSString *sql;
|
||||||
|
+
|
||||||
|
+ sql = [NSString stringWithFormat: sqlFolderFormat, tableName];
|
||||||
|
+
|
||||||
|
+ return [self evaluateExpressionX: sql];
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+- (NSException *) createGCSFolderACLTableWithName: (NSString *) tableName
|
||||||
|
+{
|
||||||
|
+ NSString *sql;
|
||||||
|
+
|
||||||
|
+ sql = [NSString stringWithFormat: sqlFolderACLFormat, tableName];
|
||||||
|
+
|
||||||
|
+ return [self evaluateExpressionX: sql];
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
@end /* MySQL4Channel */
|
||||||
|
|
||||||
|
void __link_MySQL4Channel() {
|
||||||
|
Index: sope-gdl1/Oracle8/OracleAdaptorChannel.m
|
||||||
|
===================================================================
|
||||||
|
--- sope-gdl1/Oracle8/OracleAdaptorChannel.m (revision 1660)
|
||||||
|
+++ sope-gdl1/Oracle8/OracleAdaptorChannel.m (working copy)
|
||||||
|
@@ -1,7 +1,7 @@
|
||||||
|
/*
|
||||||
|
** OracleAdaptorChannel.m
|
||||||
|
**
|
||||||
|
-** Copyright (c) 2007 Inverse groupe conseil inc. and Ludovic Marcotte
|
||||||
|
+** Copyright (c) 2007-2009 Inverse inc. and Ludovic Marcotte
|
||||||
|
**
|
||||||
|
** Author: Ludovic Marcotte <ludovic@inverse.ca>
|
||||||
|
**
|
||||||
|
@@ -30,6 +30,11 @@
|
||||||
|
|
||||||
|
#import <NGExtensions/NSObject+Logs.h>
|
||||||
|
|
||||||
|
+#include <unistd.h>
|
||||||
|
+
|
||||||
|
+static BOOL debugOn = NO;
|
||||||
|
+static int maxTry = 3;
|
||||||
|
+static int maxSleep = 500;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
@@ -41,10 +46,11 @@
|
||||||
|
|
||||||
|
@implementation OracleAdaptorChannel (Private)
|
||||||
|
|
||||||
|
-- (void) _cleanup
|
||||||
|
+- (void) _cleanup
|
||||||
|
{
|
||||||
|
column_info *info;
|
||||||
|
int c;
|
||||||
|
+ sword result;
|
||||||
|
|
||||||
|
[_resultSetProperties removeAllObjects];
|
||||||
|
|
||||||
|
@@ -58,11 +64,29 @@
|
||||||
|
// so we just free the value instead.
|
||||||
|
if (info->value)
|
||||||
|
{
|
||||||
|
- if (OCIDescriptorFree((dvoid *)info->value, (ub4)OCI_DTYPE_LOB) != OCI_SUCCESS)
|
||||||
|
+ if (info->type == SQLT_CLOB
|
||||||
|
+ || info->type == SQLT_BLOB
|
||||||
|
+ || info->type == SQLT_BFILEE
|
||||||
|
+ || info->type == SQLT_CFILEE)
|
||||||
|
+ {
|
||||||
|
+ result = OCIDescriptorFree((dvoid *)info->value, (ub4) OCI_DTYPE_LOB);
|
||||||
|
+ if (result != OCI_SUCCESS)
|
||||||
|
+ {
|
||||||
|
+ NSLog (@"value was not a LOB descriptor");
|
||||||
|
+ abort();
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
free(info->value);
|
||||||
|
info->value = NULL;
|
||||||
|
}
|
||||||
|
- free(info);
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ NSLog (@"trying to free an already freed value!");
|
||||||
|
+ abort();
|
||||||
|
+ }
|
||||||
|
+ free(info);
|
||||||
|
+
|
||||||
|
[_row_buffer removeObjectAtIndex: c];
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -78,8 +102,7 @@
|
||||||
|
//
|
||||||
|
@implementation OracleAdaptorChannel
|
||||||
|
|
||||||
|
-static void
|
||||||
|
-DBTerminate()
|
||||||
|
+static void DBTerminate()
|
||||||
|
{
|
||||||
|
if (OCITerminate(OCI_DEFAULT))
|
||||||
|
NSLog(@"FAILED: OCITerminate()");
|
||||||
|
@@ -89,6 +112,11 @@
|
||||||
|
|
||||||
|
+ (void) initialize
|
||||||
|
{
|
||||||
|
+ NSUserDefaults *ud;
|
||||||
|
+
|
||||||
|
+ ud = [NSUserDefaults standardUserDefaults];
|
||||||
|
+ debugOn = [ud boolForKey: @"OracleAdaptorDebug"];
|
||||||
|
+
|
||||||
|
// We Initialize the OCI process environment.
|
||||||
|
if (OCIInitialize((ub4)OCI_DEFAULT, (dvoid *)0,
|
||||||
|
(dvoid * (*)(dvoid *, size_t)) 0,
|
||||||
|
@@ -156,14 +184,17 @@
|
||||||
|
[super closeChannel];
|
||||||
|
|
||||||
|
// We logoff from the database.
|
||||||
|
- if (OCILogoff(_oci_ctx, _oci_err))
|
||||||
|
+ if (!_oci_ctx || !_oci_err || OCILogoff(_oci_ctx, _oci_err))
|
||||||
|
{
|
||||||
|
NSLog(@"FAILED: OCILogoff()");
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (_oci_ctx)
|
||||||
|
+ OCIHandleFree(_oci_ctx, OCI_HTYPE_SVCCTX);
|
||||||
|
|
||||||
|
- OCIHandleFree(_oci_ctx, OCI_HTYPE_SVCCTX);
|
||||||
|
- OCIHandleFree(_oci_err, OCI_HTYPE_ERROR);
|
||||||
|
+ if (_oci_err)
|
||||||
|
+ OCIHandleFree(_oci_err, OCI_HTYPE_ERROR);
|
||||||
|
+
|
||||||
|
// OCIHandleFree(_oci_env, OCI_HTYPE_ENV);
|
||||||
|
|
||||||
|
_oci_ctx = (OCISvcCtx *)0;
|
||||||
|
@@ -177,7 +208,8 @@
|
||||||
|
//
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
- //NSLog(@"OracleAdaptorChannel: -dealloc");
|
||||||
|
+ if (debugOn)
|
||||||
|
+ NSLog(@"OracleAdaptorChannel: -dealloc");
|
||||||
|
|
||||||
|
[self _cleanup];
|
||||||
|
|
||||||
|
@@ -222,7 +254,7 @@
|
||||||
|
{
|
||||||
|
EOAttribute *attribute;
|
||||||
|
OCIParam *param;
|
||||||
|
-
|
||||||
|
+ int rCount;
|
||||||
|
column_info *info;
|
||||||
|
ub4 i, clen, count;
|
||||||
|
text *sql, *cname;
|
||||||
|
@@ -231,6 +263,9 @@
|
||||||
|
|
||||||
|
[self _cleanup];
|
||||||
|
|
||||||
|
+ if (debugOn)
|
||||||
|
+ [self logWithFormat: @"expression: %@", theExpression];
|
||||||
|
+
|
||||||
|
if (!theExpression || ![theExpression length])
|
||||||
|
{
|
||||||
|
[NSException raise: @"OracleInvalidExpressionException"
|
||||||
|
@@ -244,7 +279,9 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
sql = (text *)[theExpression UTF8String];
|
||||||
|
-
|
||||||
|
+
|
||||||
|
+ rCount = 0;
|
||||||
|
+ retry:
|
||||||
|
// We alloc our statement handle
|
||||||
|
if ((status = OCIHandleAlloc((dvoid *)_oci_env, (dvoid **)&_current_stm, (ub4)OCI_HTYPE_STMT, (CONST size_t) 0, (dvoid **) 0)))
|
||||||
|
{
|
||||||
|
@@ -264,13 +301,39 @@
|
||||||
|
// We check if we're doing a SELECT and if so, we're fetching data!
|
||||||
|
OCIAttrGet(_current_stm, OCI_HTYPE_STMT, &type, 0, OCI_ATTR_STMT_TYPE, _oci_err);
|
||||||
|
self->isFetchInProgress = (type == OCI_STMT_SELECT ? YES : NO);
|
||||||
|
-
|
||||||
|
+
|
||||||
|
// We execute our statement. Not that we _MUST_ set iter to 0 for non-SELECT statements.
|
||||||
|
if ((status = OCIStmtExecute(_oci_ctx, _current_stm, _oci_err, (self->isFetchInProgress ? (ub4)0 : (ub4)1), (ub4)0, (CONST OCISnapshot *)NULL, (OCISnapshot *)NULL,
|
||||||
|
([(OracleAdaptorContext *)[self adaptorContext] autoCommit] ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT))))
|
||||||
|
{
|
||||||
|
+ ub4 serverStatus;
|
||||||
|
+
|
||||||
|
checkerr(_oci_err, status);
|
||||||
|
NSLog(@"Statement execute failed (OCI_ERROR): %@", theExpression);
|
||||||
|
+
|
||||||
|
+ // We check to see if we lost connection and need to reconnect.
|
||||||
|
+ serverStatus = 0;
|
||||||
|
+ OCIAttrGet((dvoid *)_oci_env, OCI_HTYPE_SERVER, (dvoid *)&serverStatus, (ub4 *)0, OCI_ATTR_SERVER_STATUS, _oci_err);
|
||||||
|
+
|
||||||
|
+ if (serverStatus == OCI_SERVER_NOT_CONNECTED)
|
||||||
|
+ {
|
||||||
|
+ // We cleanup our previous handles
|
||||||
|
+ [self cancelFetch];
|
||||||
|
+ [self closeChannel];
|
||||||
|
+
|
||||||
|
+ // We try to reconnect a couple of times before giving up...
|
||||||
|
+ while (rCount < maxTry)
|
||||||
|
+ {
|
||||||
|
+ usleep(maxSleep);
|
||||||
|
+ rCount++;
|
||||||
|
+
|
||||||
|
+ if ([self openChannel])
|
||||||
|
+ {
|
||||||
|
+ NSLog(@"Connection re-established to Oracle - retrying to process the statement.");
|
||||||
|
+ goto retry;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -302,7 +365,9 @@
|
||||||
|
// We read the maximum width of a column
|
||||||
|
info->max_width = 0;
|
||||||
|
status = OCIAttrGet((dvoid*)param, (ub4)OCI_DTYPE_PARAM, (dvoid*)&(info->max_width), (ub4 *)0, (ub4)OCI_ATTR_DATA_SIZE, (OCIError *)_oci_err);
|
||||||
|
-
|
||||||
|
+
|
||||||
|
+ if (debugOn)
|
||||||
|
+ NSLog(@"name: %s, type: %d", cname, info->type);
|
||||||
|
attribute = [EOAttribute attributeWithOracleType: info->type name: cname length: clen width: info->max_width];
|
||||||
|
[_resultSetProperties addObject: attribute];
|
||||||
|
|
||||||
|
@@ -394,16 +459,17 @@
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
-
|
||||||
|
if (OCIEnvInit((OCIEnv **)&_oci_env, (ub4)OCI_DEFAULT, (size_t)0, (dvoid **)0))
|
||||||
|
{
|
||||||
|
NSLog(@"FAILED: OCIEnvInit()");
|
||||||
|
+ [self closeChannel];
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OCIHandleAlloc((dvoid *)_oci_env, (dvoid *)&_oci_err, (ub4)OCI_HTYPE_ERROR, (size_t)0, (dvoid **)0))
|
||||||
|
{
|
||||||
|
NSLog(@"FAILED: OCIHandleAlloc() on errhp");
|
||||||
|
+ [self closeChannel];
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -414,7 +480,10 @@
|
||||||
|
// Under Oracle 10g, the third parameter of OCILogon() has the form: [//]host[:port][/service_name]
|
||||||
|
// See http://download-west.oracle.com/docs/cd/B12037_01/network.101/b10775/naming.htm#i498306 for
|
||||||
|
// all juicy details.
|
||||||
|
- database = [[NSString stringWithFormat:@"%@:%@", [o serverName], [o port]] UTF8String];
|
||||||
|
+ if ([o serverName] && [o port])
|
||||||
|
+ database = [[NSString stringWithFormat:@"%@:%@/%@", [o serverName], [o port], [o databaseName]] UTF8String];
|
||||||
|
+ else
|
||||||
|
+ database = [[o databaseName] UTF8String];
|
||||||
|
|
||||||
|
// We logon to the database.
|
||||||
|
if (OCILogon(_oci_env, _oci_err, &_oci_ctx, (const OraText*)username, strlen(username),
|
||||||
|
@@ -422,6 +491,7 @@
|
||||||
|
{
|
||||||
|
NSLog(@"FAILED: OCILogon(). username = %s password = %s"
|
||||||
|
@" database = %s", username, password, database);
|
||||||
|
+ [self closeChannel];
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -438,6 +508,11 @@
|
||||||
|
{
|
||||||
|
sword status;
|
||||||
|
|
||||||
|
+ // We check if our connection is open prior to trying to fetch any data. OCIStmtFetch2() returns
|
||||||
|
+ // NO error code if the OCI environment is set up but the OCILogon() has failed.
|
||||||
|
+ if (![self isOpen])
|
||||||
|
+ return nil;
|
||||||
|
+
|
||||||
|
status = OCIStmtFetch2(_current_stm, _oci_err, (ub4)1, (ub4)OCI_FETCH_NEXT, (sb4)0, (ub4)OCI_DEFAULT);
|
||||||
|
|
||||||
|
if (status == OCI_NO_DATA)
|
||||||
|
@@ -609,7 +684,7 @@
|
||||||
|
|
||||||
|
/* GCSEOAdaptorChannel protocol */
|
||||||
|
static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \
|
||||||
|
- @" c_name VARCHAR2 (256) NOT NULL,\n"
|
||||||
|
+ @" c_name VARCHAR2 (256) NOT NULL PRIMARY KEY,\n"
|
||||||
|
@" c_content CLOB NOT NULL,\n"
|
||||||
|
@" c_creationdate INTEGER NOT NULL,\n"
|
||||||
|
@" c_lastmodified INTEGER NOT NULL,\n"
|
||||||
|
Index: sope-gdl1/Oracle8/OracleAdaptorChannelController.m
|
||||||
|
===================================================================
|
||||||
|
--- sope-gdl1/Oracle8/OracleAdaptorChannelController.m (revision 1660)
|
||||||
|
+++ sope-gdl1/Oracle8/OracleAdaptorChannelController.m (working copy)
|
||||||
|
@@ -31,6 +31,8 @@
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <GDLAccess/EOSQLExpression.h>
|
||||||
|
|
||||||
|
+static BOOL debugOn = NO;
|
||||||
|
+
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
@@ -48,6 +50,14 @@
|
||||||
|
//
|
||||||
|
@implementation OracleAdaptorChannelController
|
||||||
|
|
||||||
|
++ (void) initialize
|
||||||
|
+{
|
||||||
|
+ NSUserDefaults *ud;
|
||||||
|
+
|
||||||
|
+ ud = [NSUserDefaults standardUserDefaults];
|
||||||
|
+ debugOn = [ud boolForKey: @"OracleAdaptorDebug"];
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
- (EODelegateResponse) adaptorChannel: (id) theChannel
|
||||||
|
willInsertRow: (NSMutableDictionary *) theRow
|
||||||
|
forEntity: (EOEntity *) theEntity
|
||||||
|
@@ -56,7 +66,8 @@
|
||||||
|
NSArray *keys;
|
||||||
|
int i, c;
|
||||||
|
|
||||||
|
- NSLog(@"willInsertRow: %@ %@", [theRow description], [theEntity description]);
|
||||||
|
+ if (debugOn)
|
||||||
|
+ NSLog(@"willInsertRow: %@ %@", [theRow description], [theEntity description]);
|
||||||
|
|
||||||
|
s = AUTORELEASE([[NSMutableString alloc] init]);
|
||||||
|
|
||||||
|
@@ -101,7 +112,8 @@
|
||||||
|
NSArray *keys;
|
||||||
|
int i, c;
|
||||||
|
|
||||||
|
- NSLog(@"willUpdatetRow: %@ %@", [theRow description], [theQualifier description]);
|
||||||
|
+ if (debugOn)
|
||||||
|
+ NSLog(@"willUpdateRow: %@ %@", [theRow description], [theQualifier description]);
|
||||||
|
|
||||||
|
s = AUTORELEASE([[NSMutableString alloc] init]);
|
||||||
|
|
||||||
Index: sope-mime/NGImap4/NGImap4Functions.m
|
Index: sope-mime/NGImap4/NGImap4Functions.m
|
||||||
===================================================================
|
===================================================================
|
||||||
--- sope-mime/NGImap4/NGImap4Functions.m (revision 1660)
|
--- sope-mime/NGImap4/NGImap4Functions.m (revision 1660)
|
||||||
|
@ -850,31 +1251,48 @@ Index: sope-mime/NGImap4/EOQualifier+IMAPAdditions.m
|
||||||
===================================================================
|
===================================================================
|
||||||
--- sope-mime/NGImap4/EOQualifier+IMAPAdditions.m (revision 1660)
|
--- sope-mime/NGImap4/EOQualifier+IMAPAdditions.m (revision 1660)
|
||||||
+++ sope-mime/NGImap4/EOQualifier+IMAPAdditions.m (working copy)
|
+++ sope-mime/NGImap4/EOQualifier+IMAPAdditions.m (working copy)
|
||||||
@@ -57,9 +57,9 @@
|
@@ -53,13 +53,13 @@
|
||||||
@"draft", @"flagged", @"new", @"old", @"recent",
|
if (FlagKeyWords) return;
|
||||||
@"seen", @"unanswered", @"undeleted", @"undraft",
|
|
||||||
@"unflagged", @"unseen", nil];
|
ud = [NSUserDefaults standardUserDefaults];
|
||||||
|
- FlagKeyWords = [[NSArray alloc] initWithObjects: @"answered", @"deleted",
|
||||||
|
- @"draft", @"flagged", @"new", @"old", @"recent",
|
||||||
|
- @"seen", @"unanswered", @"undeleted", @"undraft",
|
||||||
|
- @"unflagged", @"unseen", nil];
|
||||||
- OtherKeyWords = [[NSArray alloc] initWithObjects:
|
- OtherKeyWords = [[NSArray alloc] initWithObjects:
|
||||||
- @"bcc", @"body", @"cc", @"from", @"subject",
|
- @"bcc", @"body", @"cc", @"from", @"subject",
|
||||||
- @"text", @"to", @"keyword", @"unkeyword", nil];
|
- @"text", @"to", @"keyword", @"unkeyword", nil];
|
||||||
+ OtherKeyWords = [[NSArray alloc] initWithObjects: @"all", @"bcc", @"body",
|
+ FlagKeyWords = [[NSArray alloc] initWithObjects: @"ANSWERED", @"DELETED",
|
||||||
+ @"cc", @"from", @"subject", @"text", @"to",
|
+ @"DRAFT", @"FLAGGED", @"NEW", @"OLD", @"RECENT",
|
||||||
+ @"keyword", @"uid", @"unkeyword", nil];
|
+ @"SEEN", @"UNANSWERED", @"UNDELETED", @"UNDRAFT",
|
||||||
|
+ @"UNFLAGGED", @"UNSEEN", nil];
|
||||||
|
+ OtherKeyWords = [[NSArray alloc] initWithObjects: @"ALL", @"BCC", @"BODY",
|
||||||
|
+ @"CC", @"FROM", @"SUBJECT", @"TEXT", @"TO",
|
||||||
|
+ @"KEYWORD", @"UID", @"UNKEYWORD", nil];
|
||||||
|
|
||||||
debugOn = [ud boolForKey:@"ImapDebugQualifierGeneration"];
|
debugOn = [ud boolForKey:@"ImapDebugQualifierGeneration"];
|
||||||
}
|
}
|
||||||
@@ -280,15 +280,22 @@
|
@@ -266,10 +266,10 @@
|
||||||
|
|
||||||
|
enumerator = [lvalue objectEnumerator];
|
||||||
|
while ((lvalue = [enumerator nextObject]) != nil) {
|
||||||
|
- lvalue = [lvalue lowercaseString];
|
||||||
|
+ lvalue = [lvalue uppercaseString];
|
||||||
|
|
||||||
|
if ([FlagKeyWords containsObject:lvalue]) {
|
||||||
|
- if (insertNot) [search appendString:@"not "];
|
||||||
|
+ if (insertNot) [search appendString:@"NOT "];
|
||||||
|
[search appendString:lvalue];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
@@ -280,15 +280,31 @@
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
-- (NSString *)imap4OperatorForDateComparisonSelector:(SEL)lselector {
|
-- (NSString *)imap4OperatorForDateComparisonSelector:(SEL)lselector {
|
||||||
+- (NSString *)imap4OperatorForDateKeyword:(NSString *)dkey
|
+- (NSString *)imap4OperatorForDateKeyword:(NSString *)dkey
|
||||||
+andComparisonSelector:(SEL)lselector {
|
+andComparisonSelector:(SEL)lselector {
|
||||||
+ NSString *operatorPrefix, *dateOperator;
|
+ NSString *operatorPrefix, *dateOperator, *imap4Operator;
|
||||||
+ if ([dkey isEqualToString: @"date"])
|
|
||||||
+ operatorPrefix = @"sent";
|
|
||||||
+ else
|
|
||||||
+ operatorPrefix = @"";
|
|
||||||
+
|
+
|
||||||
if (sel_eq(lselector, EOQualifierOperatorEqual))
|
if (sel_eq(lselector, EOQualifierOperatorEqual))
|
||||||
- return @" senton ";
|
- return @" senton ";
|
||||||
|
@ -882,27 +1300,58 @@ Index: sope-mime/NGImap4/EOQualifier+IMAPAdditions.m
|
||||||
- return @" sentsince ";
|
- return @" sentsince ";
|
||||||
- if (sel_eq(lselector, EOQualifierOperatorLessThan))
|
- if (sel_eq(lselector, EOQualifierOperatorLessThan))
|
||||||
- return @" sentbefore ";
|
- return @" sentbefore ";
|
||||||
+ dateOperator = @"on";
|
-
|
||||||
+ else if (sel_eq(lselector, EOQualifierOperatorGreaterThan))
|
|
||||||
+ dateOperator = @"since";
|
|
||||||
+ else if (sel_eq(lselector, EOQualifierOperatorLessThan))
|
|
||||||
+ dateOperator = @"before";
|
|
||||||
|
|
||||||
- return nil;
|
- return nil;
|
||||||
+ return [NSString stringWithFormat: @" %@%@ ", operatorPrefix, dateOperator];
|
+ dateOperator = @"ON";
|
||||||
|
+ else if (sel_eq(lselector, EOQualifierOperatorGreaterThan))
|
||||||
|
+ dateOperator = @"SINCE";
|
||||||
|
+ else if (sel_eq(lselector, EOQualifierOperatorLessThan))
|
||||||
|
+ dateOperator = @"BEFORE";
|
||||||
|
+ else
|
||||||
|
+ dateOperator = nil;
|
||||||
|
+
|
||||||
|
+ if (dateOperator) {
|
||||||
|
+ if ([dkey isEqualToString: @"DATE"])
|
||||||
|
+ operatorPrefix = @"SENT";
|
||||||
|
+ else
|
||||||
|
+ operatorPrefix = @"";
|
||||||
|
+ imap4Operator = [NSString stringWithFormat: @"%@%@ ",
|
||||||
|
+ operatorPrefix, dateOperator];
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ imap4Operator = nil;
|
||||||
|
+
|
||||||
|
+ return imap4Operator;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSException *)appendToImap4SearchString:(NSMutableString *)search
|
- (NSException *)appendToImap4SearchString:(NSMutableString *)search
|
||||||
@@ -314,7 +321,7 @@
|
@@ -300,11 +316,11 @@
|
||||||
|
id lvalue;
|
||||||
|
SEL lselector;
|
||||||
|
|
||||||
|
- lkey = [[self key] lowercaseString];
|
||||||
|
+ lkey = [[self key] uppercaseString];
|
||||||
|
lvalue = [self value];
|
||||||
|
lselector = [self selector];
|
||||||
|
|
||||||
|
- if ([lkey isEqualToString:@"flags"]) {
|
||||||
|
+ if ([lkey isEqualToString:@"FLAGS"]) {
|
||||||
|
/* NOTE: special "not" processing! */
|
||||||
|
return [self appendFlagsCheckToImap4SearchString:search
|
||||||
|
insertNot:insertNot];
|
||||||
|
@@ -312,9 +328,9 @@
|
||||||
|
|
||||||
|
/* not a flag */
|
||||||
if (insertNot)
|
if (insertNot)
|
||||||
[search appendString:@"not "];
|
- [search appendString:@"not "];
|
||||||
|
+ [search appendString:@"NOT "];
|
||||||
|
|
||||||
- if ([lkey isEqualToString:@"date"]) {
|
- if ([lkey isEqualToString:@"date"]) {
|
||||||
+ if ([lkey isEqualToString:@"date"] || [lkey isEqualToString:@"receive-date"]) {
|
+ if ([lkey isEqualToString:@"DATE"] || [lkey isEqualToString:@"RECEIVE-DATE"]) {
|
||||||
NSString *s;
|
NSString *s;
|
||||||
|
|
||||||
if (![lvalue isKindOfClass:[NSCalendarDate class]]) {
|
if (![lvalue isKindOfClass:[NSCalendarDate class]]) {
|
||||||
@@ -322,7 +329,8 @@
|
@@ -322,35 +338,38 @@
|
||||||
@"expected a NSDate as value"];
|
@"expected a NSDate as value"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -911,7 +1360,54 @@ Index: sope-mime/NGImap4/EOQualifier+IMAPAdditions.m
|
||||||
+ andComparisonSelector:lselector]) == nil)
|
+ andComparisonSelector:lselector]) == nil)
|
||||||
return [self invalidImap4SearchQualifier:@"unexpected selector"];
|
return [self invalidImap4SearchQualifier:@"unexpected selector"];
|
||||||
|
|
||||||
// TODO: operator created but NOT added?
|
- // TODO: operator created but NOT added?
|
||||||
|
+ [search appendString:s];
|
||||||
|
|
||||||
|
// TODO: much faster without descriptionWithCalendarFormat:?!
|
||||||
|
- s = [lvalue descriptionWithCalendarFormat:@"%d-%b-%Y"];
|
||||||
|
+ s = [lvalue descriptionWithCalendarFormat:@"\"%d-%b-%Y\""];
|
||||||
|
[search appendString:s];
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if ([lkey isEqualToString:@"uid"]) {
|
||||||
|
- if (!sel_eq(lselector, EOQualifierOperatorEqual))
|
||||||
|
+ if ([lkey isEqualToString:@"UID"]) {
|
||||||
|
+ if (!sel_eq(lselector, EOQualifierOperatorEqual)) {
|
||||||
|
return [self invalidImap4SearchQualifier:@"unexpected qualifier 2"];
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- [search appendString:@"uid "];
|
||||||
|
+ [search appendString:@"UID "];
|
||||||
|
[search appendString:[lvalue stringValue]];
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if ([lkey isEqualToString:@"size"]) {
|
||||||
|
+ if ([lkey isEqualToString:@"SIZE"]) {
|
||||||
|
if (sel_eq(lselector, EOQualifierOperatorGreaterThan))
|
||||||
|
- [search appendString:@"larger "];
|
||||||
|
+ [search appendString:@"LARGER "];
|
||||||
|
else if (sel_eq(lselector, EOQualifierOperatorLessThan))
|
||||||
|
- [search appendString:@"smaller "];
|
||||||
|
+ [search appendString:@"SMALLER "];
|
||||||
|
else
|
||||||
|
return [self invalidImap4SearchQualifier:@"unexpected qualifier 3"];
|
||||||
|
|
||||||
|
[search appendString:[lvalue stringValue]];
|
||||||
|
+
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -386,7 +405,7 @@
|
||||||
|
if (!sel_eq(lselector, EOQualifierOperatorEqual))
|
||||||
|
return [self invalidImap4SearchQualifier:@"unexpected qualifier 5"];
|
||||||
|
|
||||||
|
- [search appendString:@"header "];
|
||||||
|
+ [search appendString:@"HEADER "];
|
||||||
|
[search appendString:lkey];
|
||||||
|
[search appendString:@" \""];
|
||||||
|
[search appendString:[lvalue stringValue]];
|
||||||
Index: sope-mime/NGImap4/NGImap4ResponseParser.m
|
Index: sope-mime/NGImap4/NGImap4ResponseParser.m
|
||||||
===================================================================
|
===================================================================
|
||||||
--- sope-mime/NGImap4/NGImap4ResponseParser.m (revision 1660)
|
--- sope-mime/NGImap4/NGImap4ResponseParser.m (revision 1660)
|
||||||
|
@ -3495,407 +3991,6 @@ Index: sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
Index: sope-gdl1/PostgreSQL/PostgreSQL72Channel.m
|
|
||||||
===================================================================
|
|
||||||
--- sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (revision 1660)
|
|
||||||
+++ sope-gdl1/PostgreSQL/PostgreSQL72Channel.m (working copy)
|
|
||||||
@@ -713,6 +713,39 @@
|
|
||||||
return ms;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/* GCSEOAdaptorChannel protocol */
|
|
||||||
+static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \
|
|
||||||
+ @" c_name VARCHAR (256) NOT NULL PRIMARY KEY,\n"
|
|
||||||
+ @" c_content VARCHAR (100000) NOT NULL,\n"
|
|
||||||
+ @" c_creationdate INT4 NOT NULL,\n"
|
|
||||||
+ @" c_lastmodified INT4 NOT NULL,\n"
|
|
||||||
+ @" c_version INT4 NOT NULL,\n"
|
|
||||||
+ @" c_deleted INT4 NULL\n"
|
|
||||||
+ @")");
|
|
||||||
+static NSString *sqlFolderACLFormat = (@"CREATE TABLE %@ (\n" \
|
|
||||||
+ @" c_uid VARCHAR (256) NOT NULL,\n"
|
|
||||||
+ @" c_object VARCHAR (256) NOT NULL,\n"
|
|
||||||
+ @" c_role VARCHAR (80) NOT NULL\n"
|
|
||||||
+ @")");
|
|
||||||
+
|
|
||||||
+- (NSException *) createGCSFolderTableWithName: (NSString *) tableName
|
|
||||||
+{
|
|
||||||
+ NSString *sql;
|
|
||||||
+
|
|
||||||
+ sql = [NSString stringWithFormat: sqlFolderFormat, tableName];
|
|
||||||
+
|
|
||||||
+ return [self evaluateExpressionX: sql];
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+- (NSException *) createGCSFolderACLTableWithName: (NSString *) tableName
|
|
||||||
+{
|
|
||||||
+ NSString *sql;
|
|
||||||
+
|
|
||||||
+ sql = [NSString stringWithFormat: sqlFolderACLFormat, tableName];
|
|
||||||
+
|
|
||||||
+ return [self evaluateExpressionX: sql];
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
@end /* PostgreSQL72Channel */
|
|
||||||
|
|
||||||
@implementation PostgreSQL72Channel(PrimaryKeyGeneration)
|
|
||||||
Index: sope-gdl1/MySQL/MySQL4Channel.m
|
|
||||||
===================================================================
|
|
||||||
--- sope-gdl1/MySQL/MySQL4Channel.m (revision 1660)
|
|
||||||
+++ sope-gdl1/MySQL/MySQL4Channel.m (working copy)
|
|
||||||
@@ -755,6 +755,39 @@
|
|
||||||
return pkey;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/* GCSEOAdaptorChannel protocol */
|
|
||||||
+static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \
|
|
||||||
+ @" c_name VARCHAR (256) NOT NULL PRIMARY KEY,\n"
|
|
||||||
+ @" c_content VARCHAR (100000) NOT NULL,\n"
|
|
||||||
+ @" c_creationdate INT NOT NULL,\n"
|
|
||||||
+ @" c_lastmodified INT NOT NULL,\n"
|
|
||||||
+ @" c_version INT NOT NULL,\n"
|
|
||||||
+ @" c_deleted INT NULL\n"
|
|
||||||
+ @")");
|
|
||||||
+static NSString *sqlFolderACLFormat = (@"CREATE TABLE %@ (\n" \
|
|
||||||
+ @" c_uid VARCHAR (256) NOT NULL,\n"
|
|
||||||
+ @" c_object VARCHAR (256) NOT NULL,\n"
|
|
||||||
+ @" c_role VARCHAR (80) NOT NULL\n"
|
|
||||||
+ @")");
|
|
||||||
+
|
|
||||||
+- (NSException *) createGCSFolderTableWithName: (NSString *) tableName
|
|
||||||
+{
|
|
||||||
+ NSString *sql;
|
|
||||||
+
|
|
||||||
+ sql = [NSString stringWithFormat: sqlFolderFormat, tableName];
|
|
||||||
+
|
|
||||||
+ return [self evaluateExpressionX: sql];
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+- (NSException *) createGCSFolderACLTableWithName: (NSString *) tableName
|
|
||||||
+{
|
|
||||||
+ NSString *sql;
|
|
||||||
+
|
|
||||||
+ sql = [NSString stringWithFormat: sqlFolderACLFormat, tableName];
|
|
||||||
+
|
|
||||||
+ return [self evaluateExpressionX: sql];
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
@end /* MySQL4Channel */
|
|
||||||
|
|
||||||
void __link_MySQL4Channel() {
|
|
||||||
Index: sope-gdl1/Oracle8/OracleAdaptorChannel.m
|
|
||||||
===================================================================
|
|
||||||
--- sope-gdl1/Oracle8/OracleAdaptorChannel.m (revision 1660)
|
|
||||||
+++ sope-gdl1/Oracle8/OracleAdaptorChannel.m (working copy)
|
|
||||||
@@ -1,7 +1,7 @@
|
|
||||||
/*
|
|
||||||
** OracleAdaptorChannel.m
|
|
||||||
**
|
|
||||||
-** Copyright (c) 2007 Inverse groupe conseil inc. and Ludovic Marcotte
|
|
||||||
+** Copyright (c) 2007-2009 Inverse inc. and Ludovic Marcotte
|
|
||||||
**
|
|
||||||
** Author: Ludovic Marcotte <ludovic@inverse.ca>
|
|
||||||
**
|
|
||||||
@@ -30,6 +30,11 @@
|
|
||||||
|
|
||||||
#import <NGExtensions/NSObject+Logs.h>
|
|
||||||
|
|
||||||
+#include <unistd.h>
|
|
||||||
+
|
|
||||||
+static BOOL debugOn = NO;
|
|
||||||
+static int maxTry = 3;
|
|
||||||
+static int maxSleep = 500;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
@@ -41,10 +46,11 @@
|
|
||||||
|
|
||||||
@implementation OracleAdaptorChannel (Private)
|
|
||||||
|
|
||||||
-- (void) _cleanup
|
|
||||||
+- (void) _cleanup
|
|
||||||
{
|
|
||||||
column_info *info;
|
|
||||||
int c;
|
|
||||||
+ sword result;
|
|
||||||
|
|
||||||
[_resultSetProperties removeAllObjects];
|
|
||||||
|
|
||||||
@@ -58,11 +64,29 @@
|
|
||||||
// so we just free the value instead.
|
|
||||||
if (info->value)
|
|
||||||
{
|
|
||||||
- if (OCIDescriptorFree((dvoid *)info->value, (ub4)OCI_DTYPE_LOB) != OCI_SUCCESS)
|
|
||||||
+ if (info->type == SQLT_CLOB
|
|
||||||
+ || info->type == SQLT_BLOB
|
|
||||||
+ || info->type == SQLT_BFILEE
|
|
||||||
+ || info->type == SQLT_CFILEE)
|
|
||||||
+ {
|
|
||||||
+ result = OCIDescriptorFree((dvoid *)info->value, (ub4) OCI_DTYPE_LOB);
|
|
||||||
+ if (result != OCI_SUCCESS)
|
|
||||||
+ {
|
|
||||||
+ NSLog (@"value was not a LOB descriptor");
|
|
||||||
+ abort();
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
free(info->value);
|
|
||||||
info->value = NULL;
|
|
||||||
}
|
|
||||||
- free(info);
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ NSLog (@"trying to free an already freed value!");
|
|
||||||
+ abort();
|
|
||||||
+ }
|
|
||||||
+ free(info);
|
|
||||||
+
|
|
||||||
[_row_buffer removeObjectAtIndex: c];
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -78,8 +102,7 @@
|
|
||||||
//
|
|
||||||
@implementation OracleAdaptorChannel
|
|
||||||
|
|
||||||
-static void
|
|
||||||
-DBTerminate()
|
|
||||||
+static void DBTerminate()
|
|
||||||
{
|
|
||||||
if (OCITerminate(OCI_DEFAULT))
|
|
||||||
NSLog(@"FAILED: OCITerminate()");
|
|
||||||
@@ -89,6 +112,11 @@
|
|
||||||
|
|
||||||
+ (void) initialize
|
|
||||||
{
|
|
||||||
+ NSUserDefaults *ud;
|
|
||||||
+
|
|
||||||
+ ud = [NSUserDefaults standardUserDefaults];
|
|
||||||
+ debugOn = [ud boolForKey: @"OracleAdaptorDebug"];
|
|
||||||
+
|
|
||||||
// We Initialize the OCI process environment.
|
|
||||||
if (OCIInitialize((ub4)OCI_DEFAULT, (dvoid *)0,
|
|
||||||
(dvoid * (*)(dvoid *, size_t)) 0,
|
|
||||||
@@ -156,14 +184,17 @@
|
|
||||||
[super closeChannel];
|
|
||||||
|
|
||||||
// We logoff from the database.
|
|
||||||
- if (OCILogoff(_oci_ctx, _oci_err))
|
|
||||||
+ if (!_oci_ctx || !_oci_err || OCILogoff(_oci_ctx, _oci_err))
|
|
||||||
{
|
|
||||||
NSLog(@"FAILED: OCILogoff()");
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (_oci_ctx)
|
|
||||||
+ OCIHandleFree(_oci_ctx, OCI_HTYPE_SVCCTX);
|
|
||||||
|
|
||||||
- OCIHandleFree(_oci_ctx, OCI_HTYPE_SVCCTX);
|
|
||||||
- OCIHandleFree(_oci_err, OCI_HTYPE_ERROR);
|
|
||||||
+ if (_oci_err)
|
|
||||||
+ OCIHandleFree(_oci_err, OCI_HTYPE_ERROR);
|
|
||||||
+
|
|
||||||
// OCIHandleFree(_oci_env, OCI_HTYPE_ENV);
|
|
||||||
|
|
||||||
_oci_ctx = (OCISvcCtx *)0;
|
|
||||||
@@ -177,7 +208,8 @@
|
|
||||||
//
|
|
||||||
- (void) dealloc
|
|
||||||
{
|
|
||||||
- //NSLog(@"OracleAdaptorChannel: -dealloc");
|
|
||||||
+ if (debugOn)
|
|
||||||
+ NSLog(@"OracleAdaptorChannel: -dealloc");
|
|
||||||
|
|
||||||
[self _cleanup];
|
|
||||||
|
|
||||||
@@ -222,7 +254,7 @@
|
|
||||||
{
|
|
||||||
EOAttribute *attribute;
|
|
||||||
OCIParam *param;
|
|
||||||
-
|
|
||||||
+ int rCount;
|
|
||||||
column_info *info;
|
|
||||||
ub4 i, clen, count;
|
|
||||||
text *sql, *cname;
|
|
||||||
@@ -231,6 +263,9 @@
|
|
||||||
|
|
||||||
[self _cleanup];
|
|
||||||
|
|
||||||
+ if (debugOn)
|
|
||||||
+ [self logWithFormat: @"expression: %@", theExpression];
|
|
||||||
+
|
|
||||||
if (!theExpression || ![theExpression length])
|
|
||||||
{
|
|
||||||
[NSException raise: @"OracleInvalidExpressionException"
|
|
||||||
@@ -244,7 +279,9 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
sql = (text *)[theExpression UTF8String];
|
|
||||||
-
|
|
||||||
+
|
|
||||||
+ rCount = 0;
|
|
||||||
+ retry:
|
|
||||||
// We alloc our statement handle
|
|
||||||
if ((status = OCIHandleAlloc((dvoid *)_oci_env, (dvoid **)&_current_stm, (ub4)OCI_HTYPE_STMT, (CONST size_t) 0, (dvoid **) 0)))
|
|
||||||
{
|
|
||||||
@@ -264,13 +301,39 @@
|
|
||||||
// We check if we're doing a SELECT and if so, we're fetching data!
|
|
||||||
OCIAttrGet(_current_stm, OCI_HTYPE_STMT, &type, 0, OCI_ATTR_STMT_TYPE, _oci_err);
|
|
||||||
self->isFetchInProgress = (type == OCI_STMT_SELECT ? YES : NO);
|
|
||||||
-
|
|
||||||
+
|
|
||||||
// We execute our statement. Not that we _MUST_ set iter to 0 for non-SELECT statements.
|
|
||||||
if ((status = OCIStmtExecute(_oci_ctx, _current_stm, _oci_err, (self->isFetchInProgress ? (ub4)0 : (ub4)1), (ub4)0, (CONST OCISnapshot *)NULL, (OCISnapshot *)NULL,
|
|
||||||
([(OracleAdaptorContext *)[self adaptorContext] autoCommit] ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT))))
|
|
||||||
{
|
|
||||||
+ ub4 serverStatus;
|
|
||||||
+
|
|
||||||
checkerr(_oci_err, status);
|
|
||||||
NSLog(@"Statement execute failed (OCI_ERROR): %@", theExpression);
|
|
||||||
+
|
|
||||||
+ // We check to see if we lost connection and need to reconnect.
|
|
||||||
+ serverStatus = 0;
|
|
||||||
+ OCIAttrGet((dvoid *)_oci_env, OCI_HTYPE_SERVER, (dvoid *)&serverStatus, (ub4 *)0, OCI_ATTR_SERVER_STATUS, _oci_err);
|
|
||||||
+
|
|
||||||
+ if (serverStatus == OCI_SERVER_NOT_CONNECTED)
|
|
||||||
+ {
|
|
||||||
+ // We cleanup our previous handles
|
|
||||||
+ [self cancelFetch];
|
|
||||||
+ [self closeChannel];
|
|
||||||
+
|
|
||||||
+ // We try to reconnect a couple of times before giving up...
|
|
||||||
+ while (rCount < maxTry)
|
|
||||||
+ {
|
|
||||||
+ usleep(maxSleep);
|
|
||||||
+ rCount++;
|
|
||||||
+
|
|
||||||
+ if ([self openChannel])
|
|
||||||
+ {
|
|
||||||
+ NSLog(@"Connection re-established to Oracle - retrying to process the statement.");
|
|
||||||
+ goto retry;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -302,7 +365,9 @@
|
|
||||||
// We read the maximum width of a column
|
|
||||||
info->max_width = 0;
|
|
||||||
status = OCIAttrGet((dvoid*)param, (ub4)OCI_DTYPE_PARAM, (dvoid*)&(info->max_width), (ub4 *)0, (ub4)OCI_ATTR_DATA_SIZE, (OCIError *)_oci_err);
|
|
||||||
-
|
|
||||||
+
|
|
||||||
+ if (debugOn)
|
|
||||||
+ NSLog(@"name: %s, type: %d", cname, info->type);
|
|
||||||
attribute = [EOAttribute attributeWithOracleType: info->type name: cname length: clen width: info->max_width];
|
|
||||||
[_resultSetProperties addObject: attribute];
|
|
||||||
|
|
||||||
@@ -394,16 +459,17 @@
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
-
|
|
||||||
if (OCIEnvInit((OCIEnv **)&_oci_env, (ub4)OCI_DEFAULT, (size_t)0, (dvoid **)0))
|
|
||||||
{
|
|
||||||
NSLog(@"FAILED: OCIEnvInit()");
|
|
||||||
+ [self closeChannel];
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OCIHandleAlloc((dvoid *)_oci_env, (dvoid *)&_oci_err, (ub4)OCI_HTYPE_ERROR, (size_t)0, (dvoid **)0))
|
|
||||||
{
|
|
||||||
NSLog(@"FAILED: OCIHandleAlloc() on errhp");
|
|
||||||
+ [self closeChannel];
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -414,7 +480,10 @@
|
|
||||||
// Under Oracle 10g, the third parameter of OCILogon() has the form: [//]host[:port][/service_name]
|
|
||||||
// See http://download-west.oracle.com/docs/cd/B12037_01/network.101/b10775/naming.htm#i498306 for
|
|
||||||
// all juicy details.
|
|
||||||
- database = [[NSString stringWithFormat:@"%@:%@", [o serverName], [o port]] UTF8String];
|
|
||||||
+ if ([o serverName] && [o port])
|
|
||||||
+ database = [[NSString stringWithFormat:@"%@:%@/%@", [o serverName], [o port], [o databaseName]] UTF8String];
|
|
||||||
+ else
|
|
||||||
+ database = [[o databaseName] UTF8String];
|
|
||||||
|
|
||||||
// We logon to the database.
|
|
||||||
if (OCILogon(_oci_env, _oci_err, &_oci_ctx, (const OraText*)username, strlen(username),
|
|
||||||
@@ -422,6 +491,7 @@
|
|
||||||
{
|
|
||||||
NSLog(@"FAILED: OCILogon(). username = %s password = %s"
|
|
||||||
@" database = %s", username, password, database);
|
|
||||||
+ [self closeChannel];
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -438,6 +508,11 @@
|
|
||||||
{
|
|
||||||
sword status;
|
|
||||||
|
|
||||||
+ // We check if our connection is open prior to trying to fetch any data. OCIStmtFetch2() returns
|
|
||||||
+ // NO error code if the OCI environment is set up but the OCILogon() has failed.
|
|
||||||
+ if (![self isOpen])
|
|
||||||
+ return nil;
|
|
||||||
+
|
|
||||||
status = OCIStmtFetch2(_current_stm, _oci_err, (ub4)1, (ub4)OCI_FETCH_NEXT, (sb4)0, (ub4)OCI_DEFAULT);
|
|
||||||
|
|
||||||
if (status == OCI_NO_DATA)
|
|
||||||
@@ -609,7 +684,7 @@
|
|
||||||
|
|
||||||
/* GCSEOAdaptorChannel protocol */
|
|
||||||
static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" \
|
|
||||||
- @" c_name VARCHAR2 (256) NOT NULL,\n"
|
|
||||||
+ @" c_name VARCHAR2 (256) NOT NULL PRIMARY KEY,\n"
|
|
||||||
@" c_content CLOB NOT NULL,\n"
|
|
||||||
@" c_creationdate INTEGER NOT NULL,\n"
|
|
||||||
@" c_lastmodified INTEGER NOT NULL,\n"
|
|
||||||
Index: sope-gdl1/Oracle8/OracleAdaptorChannelController.m
|
|
||||||
===================================================================
|
|
||||||
--- sope-gdl1/Oracle8/OracleAdaptorChannelController.m (revision 1660)
|
|
||||||
+++ sope-gdl1/Oracle8/OracleAdaptorChannelController.m (working copy)
|
|
||||||
@@ -31,6 +31,8 @@
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <GDLAccess/EOSQLExpression.h>
|
|
||||||
|
|
||||||
+static BOOL debugOn = NO;
|
|
||||||
+
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
@@ -48,6 +50,14 @@
|
|
||||||
//
|
|
||||||
@implementation OracleAdaptorChannelController
|
|
||||||
|
|
||||||
++ (void) initialize
|
|
||||||
+{
|
|
||||||
+ NSUserDefaults *ud;
|
|
||||||
+
|
|
||||||
+ ud = [NSUserDefaults standardUserDefaults];
|
|
||||||
+ debugOn = [ud boolForKey: @"OracleAdaptorDebug"];
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
- (EODelegateResponse) adaptorChannel: (id) theChannel
|
|
||||||
willInsertRow: (NSMutableDictionary *) theRow
|
|
||||||
forEntity: (EOEntity *) theEntity
|
|
||||||
@@ -56,7 +66,8 @@
|
|
||||||
NSArray *keys;
|
|
||||||
int i, c;
|
|
||||||
|
|
||||||
- NSLog(@"willInsertRow: %@ %@", [theRow description], [theEntity description]);
|
|
||||||
+ if (debugOn)
|
|
||||||
+ NSLog(@"willInsertRow: %@ %@", [theRow description], [theEntity description]);
|
|
||||||
|
|
||||||
s = AUTORELEASE([[NSMutableString alloc] init]);
|
|
||||||
|
|
||||||
@@ -101,7 +112,8 @@
|
|
||||||
NSArray *keys;
|
|
||||||
int i, c;
|
|
||||||
|
|
||||||
- NSLog(@"willUpdatetRow: %@ %@", [theRow description], [theQualifier description]);
|
|
||||||
+ if (debugOn)
|
|
||||||
+ NSLog(@"willUpdateRow: %@ %@", [theRow description], [theQualifier description]);
|
|
||||||
|
|
||||||
s = AUTORELEASE([[NSMutableString alloc] init]);
|
|
||||||
|
|
||||||
Index: sope-core/NGExtensions/NGExtensions/NSString+Ext.h
|
Index: sope-core/NGExtensions/NGExtensions/NSString+Ext.h
|
||||||
===================================================================
|
===================================================================
|
||||||
--- sope-core/NGExtensions/NGExtensions/NSString+Ext.h (revision 1660)
|
--- sope-core/NGExtensions/NGExtensions/NSString+Ext.h (revision 1660)
|
||||||
|
|
Loading…
Reference in New Issue