Monotone-Parent: 24ba5bd537bf1999f7443bca34f07358c1ea42d9
Monotone-Revision: 94d50c27be1b236681a2089a0eecac7c67e93f40 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-12-07T20:34:29 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
19720a645f
commit
60ae2b07af
|
@ -1,3 +1,9 @@
|
||||||
|
2007-12-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* Main/SOGo.m ([SOGo -run]): the table creation script now have a
|
||||||
|
@{tableName} substitution variable to be substitued with the real
|
||||||
|
table name obtained from the configuration variables.
|
||||||
|
|
||||||
2007-12-07 Ludovic Marcotte <ludovic@inverse.ca>
|
2007-12-07 Ludovic Marcotte <ludovic@inverse.ca>
|
||||||
|
|
||||||
* UI/MailPartViewers/UIxMailRenderingContext.m
|
* UI/MailPartViewers/UIxMailRenderingContext.m
|
||||||
|
|
56
Main/SOGo.m
56
Main/SOGo.m
|
@ -151,27 +151,26 @@ static BOOL debugObjectAllocation = NO;
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) _checkTableWithCM: (GCSChannelManager *) cm
|
- (NSString *) _sqlScriptFromTableFile: (NSString *) fileName
|
||||||
tableURL: (NSString *) url
|
withTableName: (NSString *) tableName
|
||||||
andType: (NSString *) tableType
|
|
||||||
{
|
{
|
||||||
NSString *tableName, *descFile, *tableFile, *fileSuffix;
|
NSString *script;
|
||||||
EOAdaptorChannel *tc;
|
|
||||||
|
|
||||||
|
return script;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *) _sqlScriptForTable: (NSString *) tableName
|
||||||
|
withType: (NSString *) tableType
|
||||||
|
andFileSuffix: (NSString *) fileSuffix
|
||||||
|
{
|
||||||
|
NSString *tableFile, *descFile;
|
||||||
NGBundleManager *bm;
|
NGBundleManager *bm;
|
||||||
NSBundle *bundle;
|
NSBundle *bundle;
|
||||||
unsigned int length;
|
unsigned int length;
|
||||||
NSURL *channelURL;
|
|
||||||
|
|
||||||
bm = [NGBundleManager defaultBundleManager];
|
bm = [NGBundleManager defaultBundleManager];
|
||||||
|
|
||||||
channelURL = [NSURL URLWithString: url];
|
|
||||||
fileSuffix = [channelURL scheme];
|
|
||||||
tc = [cm acquireOpenChannelForURL: channelURL];
|
|
||||||
|
|
||||||
tableName = [url lastPathComponent];
|
|
||||||
if ([tc evaluateExpressionX:
|
|
||||||
[NSString stringWithFormat: @"SELECT count(*) FROM %@", tableName]])
|
|
||||||
{
|
|
||||||
bundle = [bm bundleWithName: @"MainUI" type: @"SOGo"];
|
bundle = [bm bundleWithName: @"MainUI" type: @"SOGo"];
|
||||||
length = [tableType length] - 3;
|
length = [tableType length] - 3;
|
||||||
tableFile = [tableType substringToIndex: length];
|
tableFile = [tableType substringToIndex: length];
|
||||||
|
@ -181,8 +180,33 @@ static BOOL debugObjectAllocation = NO;
|
||||||
ofType: @"sql"];
|
ofType: @"sql"];
|
||||||
if (!descFile)
|
if (!descFile)
|
||||||
descFile = [bundle pathForResource: tableFile ofType: @"sql"];
|
descFile = [bundle pathForResource: tableFile ofType: @"sql"];
|
||||||
if (![tc evaluateExpressionX:
|
|
||||||
[NSString stringWithContentsOfFile: descFile]])
|
return [[NSString stringWithContentsOfFile: descFile]
|
||||||
|
stringByReplacingString: @"@{tableName}"
|
||||||
|
withString: tableName];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) _checkTableWithCM: (GCSChannelManager *) cm
|
||||||
|
tableURL: (NSString *) url
|
||||||
|
andType: (NSString *) tableType
|
||||||
|
{
|
||||||
|
NSString *tableName, *fileSuffix, *tableScript;
|
||||||
|
EOAdaptorChannel *tc;
|
||||||
|
NSURL *channelURL;
|
||||||
|
|
||||||
|
channelURL = [NSURL URLWithString: url];
|
||||||
|
fileSuffix = [channelURL scheme];
|
||||||
|
tc = [cm acquireOpenChannelForURL: channelURL];
|
||||||
|
|
||||||
|
tableName = [url lastPathComponent];
|
||||||
|
if ([tc evaluateExpressionX:
|
||||||
|
[NSString stringWithFormat: @"SELECT count(*) FROM %@",
|
||||||
|
tableName]])
|
||||||
|
{
|
||||||
|
tableScript = [self _sqlScriptForTable: tableName
|
||||||
|
withType: tableType
|
||||||
|
andFileSuffix: fileSuffix];
|
||||||
|
if (![tc evaluateExpressionX: tableScript])
|
||||||
[self logWithFormat: @"table '%@' successfully created!", tableName];
|
[self logWithFormat: @"table '%@' successfully created!", tableName];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
-- (C) 2007 Inverse groupe conseil
|
-- (C) 2007 Inverse groupe conseil
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE SOGo_user_profile (
|
CREATE TABLE @{tableName} (
|
||||||
c_uid VARCHAR(255) NOT NULL PRIMARY KEY,
|
c_uid VARCHAR(255) NOT NULL PRIMARY KEY,
|
||||||
c_defaults CLOB,
|
c_defaults CLOB,
|
||||||
c_settings CLOB
|
c_settings CLOB
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
-- (C) 2006-2007 Inverse groupe conseil
|
-- (C) 2006-2007 Inverse groupe conseil
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE SOGo_user_profile (
|
CREATE TABLE @{tableName} (
|
||||||
c_uid VARCHAR(255) NOT NULL PRIMARY KEY,
|
c_uid VARCHAR(255) NOT NULL PRIMARY KEY,
|
||||||
c_defaults TEXT,
|
c_defaults TEXT,
|
||||||
c_settings TEXT
|
c_settings TEXT
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
-- (C) 2007 Inverse groupe conseil
|
-- (C) 2007 Inverse groupe conseil
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE SOGo_folder_info (
|
CREATE TABLE @{tableName} (
|
||||||
c_folder_id INTEGER PRIMARY KEY,
|
c_folder_id INTEGER PRIMARY KEY,
|
||||||
c_path VARCHAR(255) NOT NULL, -- the full path to the folder
|
c_path VARCHAR(255) NOT NULL, -- the full path to the folder
|
||||||
c_path1 VARCHAR(255) NOT NULL, -- parts (for fast queries)
|
c_path1 VARCHAR(255) NOT NULL, -- parts (for fast queries)
|
||||||
|
@ -16,12 +16,12 @@ CREATE TABLE SOGo_folder_info (
|
||||||
c_folder_type VARCHAR(255) NOT NULL -- the folder type ...
|
c_folder_type VARCHAR(255) NOT NULL -- the folder type ...
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE SEQUENCE SOGo_folder_info_seq;
|
CREATE SEQUENCE @{tableName}_seq;
|
||||||
CREATE OR REPLACE TRIGGER SOGo_folder_info_autonumber
|
CREATE OR REPLACE TRIGGER @{tableName}_autonumber
|
||||||
BEFORE INSERT ON SOGo_folder_info FOR EACH ROW
|
BEFORE INSERT ON @{tableName} FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
IF :new.c_folder_id IS NULL THEN
|
IF :new.c_folder_id IS NULL THEN
|
||||||
SELECT SOGO_folder_info_seq.nextval INTO :new.c_folder_id FROM DUAL;
|
SELECT @{tableName}_seq.nextval INTO :new.c_folder_id FROM DUAL;
|
||||||
END IF;
|
END IF;
|
||||||
END;
|
END;
|
||||||
/
|
/
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
-- (C) 2006-2007 Inverse groupe conseil
|
-- (C) 2006-2007 Inverse groupe conseil
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE SOGo_folder_info (
|
CREATE TABLE @{tableName} (
|
||||||
c_folder_id SERIAL,
|
c_folder_id SERIAL,
|
||||||
c_path VARCHAR(255) NOT NULL, -- the full path to the folder
|
c_path VARCHAR(255) NOT NULL, -- the full path to the folder
|
||||||
c_path1 VARCHAR(255) NOT NULL, -- parts (for fast queries)
|
c_path1 VARCHAR(255) NOT NULL, -- parts (for fast queries)
|
||||||
|
|
Loading…
Reference in New Issue