public void MyTestInitialize() { TsXml = new TSXml(); TsImportList = new List<TSImport>(); }
public void MyTestCleanup() { TsXml = null; TsImportList = null; }
/// <summary> /// This method reads the given XML file and stores any time series that are defined in the /// XML file to the database using the given database connection number and database table name. /// Each time series is also stored in a new TSImport object that is addded to the given List /// of TSImport objects. /// </summary> /// <param name="connectionNumber">The serial number of the connection that is used to write to the database</param> /// <param name="tableName">The name of the database table that time series will be written to</param> /// <param name="traceTableName">The name of the database table that stores the BLOB for a single trace</param> /// <param name="xmlFileName">The file name (with path) of an XML file that defines one or more time series to import</param> /// <param name="tsImportList">A List of TSImport objects that the method adds to. One item is added to the List /// for each time series that is processed in the XML file. The List must already be instantiated before calling /// this method. The method does not change any items that are already in the List.</param> /// <returns>The number of time series records that were successfully stored</returns> public int XmlImportAndSaveToDB(int connectionNumber, String tableName, String traceTableName, String xmlFileName, List<TSImport> tsImportList) { // Get the connection that we'll pass along. SqlConnection connx = GetConnectionFromId(connectionNumber); // Construct new TSXml object with SqlConnection object and table name TSXml tsXml = new TSXml(connx, ConnxObject, tableName, traceTableName); // Method in the TSXml object does all the work return tsXml.ReadAndStore(xmlFileName, null, tsImportList, true, true); }
/// <summary> /// This method reads the given XML string and stores each time series that is defined in the /// XML file to a new TSImport object that is added to the given List of TSImport objects. /// </summary> /// <param name="xmlString">the string containing XML that defines one or more time series to import</param> /// <param name="tsImportList">A List of TSImport objects that the method adds to. One item is added to the List /// for each time series that is processed in the XML string. The List must already be instantiated before calling /// this method. The method does not change any items that are already in the List.</param> /// <returns>The number of time series records that were successfully read and added to tsImportList</returns> public int XmlImportFromString(String xmlString, List<TSImport> tsImportList) { // Construct new TSXml object without SqlConnection object and table name TSXml tsXml = new TSXml(); // Method in the TSXml object does all the work return tsXml.ReadAndStore(null, xmlString, tsImportList, false, true); }
/// <summary> /// This method reads the given XML file and stores any time series that are defined in the /// XML file to the database using the given database connection number and database table name. /// For each time series that the method adds to the database, it adds a TSImport object to the /// given List of TSImport objects. Each TSImport object records fields that were read from the /// XML file, but which TSLibrary does not process. /// </summary> /// <param name="connectionNumber">The serial number of the connection that is used to write to the database</param> /// <param name="paramTableName">The name of the database table that time series will be written to</param> /// <param name="traceTableName">The name of the database table that stores the BLOB for a single trace</param> /// <param name="xmlFileName">The file name (with path) of an XML file that defines one or more time series to import</param> /// <param name="tsImportList">A List of TSImport objects that the method adds to--one item for each time series /// that is saved to the database. The List must already be instantiated before calling this method. /// The method does not change any items that are already in the List.</param> /// <returns>The number of time series records that were successfully stored</returns> //[ComVisible(true)] // TODO: this is not COM friendly due to the List<> object public int XmlImportWithList(int connectionNumber, String paramTableName, String traceTableName, String xmlFileName, List<TSImport> tsImportList) { // Get the connection that we'll pass along. SqlConnection connx = GetConnectionFromId(connectionNumber); // Construct new TSXml object with SqlConnection object and table name TSXml tsXml = new TSXml(connx, TSLib.ConnxObject, paramTableName, traceTableName); return tsXml.ReadAndStore(xmlFileName, null, tsImportList, true, false); }