COREHL7 API Online Help - Region 4: [CORE HL7 MSSQL] |
Description: Provides access to all CORE HL7 MS SQL Schema functions.

The HL7MSSQLController object's primary purpose is to verify that you have the appropriate license and then to allow you create the COREHL7MSSQLSchema object which is the true entry point for your MS SQL HL7 Database. From this object you will create your main Schema Engine Objects:
•The COREHL7SQLSchemaInfo object for validating and verifying your Schema.
•The COREHL7SQLImporter object for importing HL7 messages into your Schema.
•the COREHL7SQLMaintenance object for basic database maintenance to keep your tables from getting too large.
private static HL7MSSQLController GetController() { string licensefile = "C:\\Licenses\\COREAPI.txt"; return new HL7MSSQLController(licensefile); } public COREException LastExeception { get; private set; } = new COREException(); COREHL7MSSQLConnector cn = new COREHL7MSSQLConnector(); HL7MSSQLController myCTL = GetController(); COREHL7MSSQLSchema mySchema; string myPrefix = "AAA"; //Constructor public CodeExamples() { if (!myCTL.License.IsEnterpriseLicense()) { //NOTHING WILL WORK. GET OUT return; } cn = new COREHL7MSSQLConnector("myserver", "mydatabasename"); //Connector will use trusted connection with a //connection timeout of 40 seconds (the default values) cn.TransactionRunning += TransactionEvent;
mySchema = myCTL.NewCOREHL7MSSQLSchema(cn, myPrefix);
//That is it we are ready to do everything. } public bool MySchemaExists() { if (mySchema == null) { LastExeception.SetException("MySchema is null", "MySchemaExists()", 12345); return false; } LastExeception.Clear(); return mySchema.VerifySchemaIsPresent().Success; }
|
|
|
private static HL7MSSQLController GetController() { string licensefile = "C:\\Licenses\\COREAPI.txt"; return new HL7MSSQLController(licensefile); } public COREException LastExeception { get; private set; } = new COREException(); COREHL7MSSQLConnector cn = new COREHL7MSSQLConnector(); HL7MSSQLController myCTL = GetController(); COREHL7MSSQLSchema mySchema; string myPrefix = "AAA"; //Constructor public CodeExamples() { if (!myCTL.License.IsEnterpriseLicense()) { //NOTHING WILL WORK. GET OUT return; } cn = new COREHL7MSSQLConnector("myserver", "mydatabasename"); //Connector will use trusted connection with a //connection timeout of 40 seconds (the default values) cn.TransactionRunning += TransactionEvent;
mySchema = myCTL.NewCOREHL7MSSQLSchema(cn, myPrefix);
//That is it we are ready to do everything. } public bool CreateSchema() { if (LastExeception.ExceptionNumber == FatalErrorNumber) { return false; }
//hard code the file name string hl7defFile = "C:\\HL7Defs\\Default22.vDef"; HL7Definition def = myCTL.NewVendorDefinition(hl7defFile); if (!mySchema.CreateSchemaTables(def)) { //copy the exception LastExeception.SetException(mySchema.LastException); return false; } LastExeception.Clear(); return true; }
public bool MySchemaExists() { if (mySchema == null) { LastExeception.SetException("MySchema is null", "MySchemaExists()", 12345); return false; } LastExeception.Clear(); return mySchema.VerifySchemaIsPresent().Success; }
|
private static HL7MSSQLController GetController() { string licensefile = "C:\\Licenses\\COREAPI.txt"; return new HL7MSSQLController(licensefile); } public COREException LastExeception { get; private set; } = new COREException(); COREHL7MSSQLConnector cn = new COREHL7MSSQLConnector(); HL7MSSQLController myCTL = GetController(); COREHL7MSSQLSchema mySchema; string myPrefix = "AAA"; //Constructor public CodeExamples() { if (!myCTL.License.IsEnterpriseLicense()) { //NOTHING WILL WORK. GET OUT return; } cn = new COREHL7MSSQLConnector("myserver", "mydatabasename"); //Connector will use trusted connection with a //connection timeout of 40 seconds (the default values) cn.TransactionRunning += TransactionEvent;
mySchema = myCTL.NewCOREHL7MSSQLSchema(cn, myPrefix);
//That is it we are ready to do everything. }
public bool DropSchema() { if (LastExeception.ExceptionNumber == FatalErrorNumber) { return false; } COREMSSQLHL7VerifySchemaResult res = mySchema.VerifySchemaIsPresent(); //I could just check res.Success BUT instead I'm going to check SchemaTablesCount. if (mySchema.SchemaTablesCount == 0) { //Is it REALLY 0 or was there a database error if (mySchema.SQLServerConnectorError) { //it was a connector error //Copy the exception LastExeception.SetException(mySchema.LastException); return false; } //It REALLY Is 0, no need to drop anything return true; } bool ret = mySchema.DropSchemaTables(); if (!ret) { //Something happened //Copy the exception LastExeception.SetException(mySchema.LastException); return false; } //It ran with no errors. return true; }
public bool CreateSchema() { if (LastExeception.ExceptionNumber == FatalErrorNumber) { return false; }
//hard code the file name string hl7defFile = "C:\\HL7Defs\\Default22.vDef"; HL7Definition def = myCTL.NewVendorDefinition(hl7defFile); if (!mySchema.CreateSchemaTables(def)) { //copy the exception LastExeception.SetException(mySchema.LastException); return false; } LastExeception.Clear(); return true; }
public bool MySchemaExists() { if (mySchema == null) { LastExeception.SetException("MySchema is null", "MySchemaExists()", 12345); return false; } LastExeception.Clear(); return mySchema.VerifySchemaIsPresent().Success; }
|