public CorrelatedResSyncTable(int resourceKindId, IResourceKindTable resourceKindTable, IEndpointTable endpointTable) { this.ResourceKindId = resourceKindId; this.ResourceKindTable = resourceKindTable; this.EndpointTable = endpointTable; string tableName; string[] sqlQueries = new string[4]; tableName = string.Format("{0}tblCorrelatedResSync{1}", Settings.Default.TablePrefix, resourceKindId); sqlQueries[0] = string.Format("CREATE TABLE [{0}] ", tableName); sqlQueries[0] += "([Uuid] TEXT(38) NOT NULL, "; sqlQueries[0] += " [Tick] INTEGER NOT NULL, "; sqlQueries[0] += " [ModifiedStamp] TIMESTAMP NOT NULL, "; sqlQueries[0] += " [Etag] TEXT(255) NOT NULL, "; sqlQueries[0] += " [LocalId] TEXT(40) NOT NULL, "; sqlQueries[0] += " [FKEndpointId] INTEGER NOT NULL, "; sqlQueries[0] += " [FKResourceKindId] INTEGER NOT NULL); "; sqlQueries[1] = string.Format("CREATE UNIQUE INDEX PK ON [{0}] ([Uuid], [LocalId]) WITH PRIMARY;", tableName); sqlQueries[2] = string.Format("ALTER TABLE {0} ADD CONSTRAINT FK_{0}_FKEndpointId FOREIGN KEY (FKEndpointId) REFERENCES {1} (ID)", tableName, endpointTable.TableName); sqlQueries[3] = string.Format("ALTER TABLE {0} ADD CONSTRAINT FK_{0}_FKResourceKindId FOREIGN KEY (FKResourceKindId) REFERENCES {1} (ID)", tableName, resourceKindTable.TableName); _jetTableImp = new JetTableSchema(tableName, sqlQueries); }
public SyncResultsTable(int resourceKindId, IResourceKindTable resourceKindTable) { this.ResourceKindId = resourceKindId; this.ResourceKindTable = resourceKindTable; string tableName; string[] sqlQueries = new string[2]; tableName = string.Format("{0}tblSyncResults{1}", Settings.Default.TablePrefix, resourceKindId); sqlQueries[0] = string.Format("CREATE TABLE [{0}] ", tableName); sqlQueries[0] += "([ID] COUNTER, "; sqlQueries[0] += " [HttpMethod] TEXT(40) NOT NULL, "; sqlQueries[0] += " [HttpStatus] INTEGER NOT NULL, "; sqlQueries[0] += " [HttpMessage] TEXT(255) DEFAULT NULL, "; sqlQueries[0] += " [HttpLocation] TEXT(255) DEFAULT NULL, "; sqlQueries[0] += " [Diagnoses] MEMO DEFAULT NULL, "; sqlQueries[0] += " [Payload] MEMO DEFAULT NULL, "; sqlQueries[0] += " [EndPoint] TEXT(255) NOT NULL, "; sqlQueries[0] += " [Stamp] TIMESTAMP NOT NULL, "; sqlQueries[0] += " [RunName] TEXT(100) DEFAULT NULL, "; sqlQueries[0] += " [RunStamp] TEXT(40) DEFAULT NULL);"; sqlQueries[1] = string.Format("CREATE UNIQUE INDEX PK_ID ON [{0}] ([ID]) WITH PRIMARY;", tableName); _jetTableImp = new JetTableSchema(tableName, sqlQueries); }
public SyncDigestTable(IResourceKindTable resourceKindTable, IEndPointTable EndPointTable) { this.ResourceKindTable = resourceKindTable; this.EndPointTable = EndPointTable; string tableName; string[] sqlQueries = new string[4]; tableName = string.Format("{0}tblSyncDigest", Settings.Default.TablePrefix); sqlQueries[0] = string.Format("CREATE TABLE [{0}] ", tableName); sqlQueries[0] += "([tick] INTEGER NOT NULL, "; sqlQueries[0] += " [ConflictPriority] INTEGER NOT NULL, "; sqlQueries[0] += " [Stamp] TIMESTAMP NOT NULL, "; sqlQueries[0] += " [FKEndPointId] INTEGER NOT NULL, "; sqlQueries[0] += " [FKResourceKindId] INTEGER NOT NULL);"; sqlQueries[1] = string.Format("CREATE UNIQUE INDEX PK_ID ON [{0}] ([FKEndPointId],[FKResourceKindId]) WITH PRIMARY;", tableName); sqlQueries[2] = string.Format("ALTER TABLE {0} ADD CONSTRAINT FK_{0}_FKEndPointId FOREIGN KEY (FKEndPointId) REFERENCES {1} (ID)", tableName, EndPointTable.TableName); sqlQueries[3] = string.Format("ALTER TABLE {0} ADD CONSTRAINT FK_{0}_FKResourceKindId FOREIGN KEY (FKResourceKindId) REFERENCES {1} (ID)", tableName, resourceKindTable.TableName); _jetTableImp = new JetTableSchema(tableName, sqlQueries); }
public CorrelatedResSyncTable(int resourceKindId, IResourceKindTable resourceKindTable, IEndPointTable EndPointTable) { this.ResourceKindId = resourceKindId; this.ResourceKindTable = resourceKindTable; this.EndPointTable = EndPointTable; string tableName; string[] sqlQueries = new string[4]; tableName = string.Format("{0}tblCorrelatedResSync{1}", Settings.Default.TablePrefix, resourceKindId); sqlQueries[0] = string.Format("CREATE TABLE [{0}] ", tableName); sqlQueries[0] += "([Uuid] TEXT(38) NOT NULL, "; sqlQueries[0] += " [tick] INTEGER NOT NULL, "; sqlQueries[0] += " [ModifiedStamp] TIMESTAMP NOT NULL, "; sqlQueries[0] += " [Etag] TEXT(255) NOT NULL, "; sqlQueries[0] += " [LocalId] TEXT(40) NOT NULL, "; sqlQueries[0] += " [FKEndPointId] INTEGER NOT NULL, "; sqlQueries[0] += " [FKResourceKindId] INTEGER NOT NULL); "; sqlQueries[1] = string.Format("CREATE UNIQUE INDEX PK ON [{0}] ([Uuid], [LocalId]) WITH PRIMARY;", tableName); sqlQueries[2] = string.Format("ALTER TABLE {0} ADD CONSTRAINT FK_{0}_FKEndPointId FOREIGN KEY (FKEndPointId) REFERENCES {1} (ID)", tableName, EndPointTable.TableName); sqlQueries[3] = string.Format("ALTER TABLE {0} ADD CONSTRAINT FK_{0}_FKResourceKindId FOREIGN KEY (FKResourceKindId) REFERENCES {1} (ID)", tableName, resourceKindTable.TableName); _jetTableImp = new JetTableSchema(tableName, sqlQueries); }
public ResourceKindTable() { string tableName; string[] sqlQueries = new string[3]; tableName = string.Format("{0}tblResourceKind", Settings.Default.TablePrefix); sqlQueries[0] = string.Format("CREATE TABLE [{0}] ", tableName); sqlQueries[0] += "([ID] COUNTER, "; sqlQueries[0] += " [Name] TEXT(40) NOT NULL);"; sqlQueries[1] = string.Format("CREATE UNIQUE INDEX PK_ID ON [{0}] ([ID]) WITH PRIMARY;", tableName); sqlQueries[2] = string.Format("CREATE UNIQUE INDEX IDX_Name ON [{0}] ([Name])", tableName); _jetTableImp = new JetTableSchema(tableName, sqlQueries); }
public EndpointTable() { string tableName; string[] sqlQueries = new string[3]; tableName = string.Format("{0}tblEndpoint", Settings.Default.TablePrefix); sqlQueries[0] = string.Format("CREATE TABLE [{0}] ", tableName); sqlQueries[0] += "([ID] COUNTER, "; sqlQueries[0] += " [Endpoint] TEXT(255) NOT NULL);"; sqlQueries[1] = string.Format("CREATE UNIQUE INDEX PK_ID ON [{0}] ([ID]) WITH PRIMARY;", tableName); sqlQueries[2] = string.Format("CREATE UNIQUE INDEX IDX_ENDPOINT ON [{0}] ([Endpoint])", tableName); _jetTableImp = new JetTableSchema(tableName, sqlQueries); }
public EndPointTable() { string tableName; string[] sqlQueries = new string[3]; tableName = string.Format("{0}tblEndPoint", Settings.Default.TablePrefix); sqlQueries[0] = string.Format("CREATE TABLE [{0}] ", tableName); sqlQueries[0] += "([ID] COUNTER, "; sqlQueries[0] += " [EndPoint] TEXT(255) NOT NULL);"; sqlQueries[1] = string.Format("CREATE UNIQUE INDEX PK_ID ON [{0}] ([ID]) WITH PRIMARY;", tableName); sqlQueries[2] = string.Format("CREATE UNIQUE INDEX IDX_EndPoint ON [{0}] ([EndPoint])", tableName); _jetTableImp = new JetTableSchema(tableName, sqlQueries); }
public tickTable(IResourceKindTable resourceKindTable) { this.ResourceKindTable = resourceKindTable; string tableName; string[] sqlQueries = new string[3]; tableName = string.Format("{0}tbltick", Settings.Default.TablePrefix); sqlQueries[0] = string.Format("CREATE TABLE [{0}] ", tableName); sqlQueries[0] += "([FKResourceKindId] INTEGER NOT NULL, "; sqlQueries[0] += " [tick] INTEGER NOT NULL);"; sqlQueries[1] = string.Format("CREATE UNIQUE INDEX PK ON [{0}] ([FKResourceKindId]) WITH PRIMARY;", tableName); sqlQueries[2] = string.Format("ALTER TABLE {0} ADD CONSTRAINT FK_{0}_FKResourceKindId FOREIGN KEY (FKResourceKindId) REFERENCES {1} (ID);", tableName, this.ResourceKindTable.TableName); _jetTableImp = new JetTableSchema(tableName, sqlQueries); }
public SyncDigestTable(IResourceKindTable resourceKindTable, IEndpointTable endpointTable) { this.ResourceKindTable = resourceKindTable; this.EndpointTable = endpointTable; string tableName; string[] sqlQueries = new string[4]; tableName = string.Format("{0}tblSyncDigest", Settings.Default.TablePrefix); sqlQueries[0] = string.Format("CREATE TABLE [{0}] ", tableName); sqlQueries[0] += "([Tick] INTEGER NOT NULL, "; sqlQueries[0] += " [ConflictPriority] INTEGER NOT NULL, "; sqlQueries[0] += " [Stamp] TIMESTAMP NOT NULL, "; sqlQueries[0] += " [FKEndpointId] INTEGER NOT NULL, "; sqlQueries[0] += " [FKResourceKindId] INTEGER NOT NULL);"; sqlQueries[1] = string.Format("CREATE UNIQUE INDEX PK_ID ON [{0}] ([FKEndpointId],[FKResourceKindId]) WITH PRIMARY;", tableName); sqlQueries[2] = string.Format("ALTER TABLE {0} ADD CONSTRAINT FK_{0}_FKEndpointId FOREIGN KEY (FKEndpointId) REFERENCES {1} (ID)", tableName, endpointTable.TableName); sqlQueries[3] = string.Format("ALTER TABLE {0} ADD CONSTRAINT FK_{0}_FKResourceKindId FOREIGN KEY (FKResourceKindId) REFERENCES {1} (ID)", tableName, resourceKindTable.TableName); _jetTableImp = new JetTableSchema(tableName, sqlQueries); }