Skip to content

Commit

Permalink
TimeSeriesStartupOperations and Adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
collins-self committed Dec 26, 2024
1 parent 68fe330 commit 2018a9e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
12 changes: 6 additions & 6 deletions Source/Libraries/GSF.TimeSeries/TimeSeriesStartupOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private static void ValidateDefaultNode(AdoDataConnection database, string nodeI
return;

database.Connection.ExecuteNonQuery(NodeInsertFormat);
database.Connection.ExecuteNonQuery(string.Format(NodeUpdateFormat, nodeIDQueryString));
database.Connection.ExecuteNonQuery(NodeUpdateFormat, nodeIDQueryString);
}

/// <summary>
Expand Down Expand Up @@ -254,19 +254,19 @@ private static void ValidateDataPublishers(AdoDataConnection database, string no
int sttpsDataPublisherCount = Convert.ToInt32(database.Connection.ExecuteScalar(DataPublisherCountFormat, "STTPS", nodeIDQueryString));

if (internalDataPublisherCount == 0)
database.Connection.ExecuteNonQuery(string.Format(GEPDataPublisherInsertFormat, nodeIDQueryString, "INTERNAL", "None", "cacheMeasurementKeys={FILTER ActiveMeasurements WHERE SignalType = ''STAT''}", internalDataPublisherEnabled ? 1 : 0));
database.Connection.ExecuteNonQuery(GEPDataPublisherInsertFormat, nodeIDQueryString, "INTERNAL", "None", "cacheMeasurementKeys={FILTER ActiveMeasurements WHERE SignalType = ''STAT''}", internalDataPublisherEnabled ? 1 : 0);

if (externalDataPublisherCount == 0)
database.Connection.ExecuteNonQuery(string.Format(GEPDataPublisherInsertFormat, nodeIDQueryString, "EXTERNAL", "Gateway", "", externalDataPublisherEnabled ? 1 : 0));
database.Connection.ExecuteNonQuery(GEPDataPublisherInsertFormat, nodeIDQueryString, "EXTERNAL", "Gateway", "", externalDataPublisherEnabled ? 1 : 0);

if (tlsDataPublisherCount == 0)
database.Connection.ExecuteNonQuery(string.Format(GEPDataPublisherInsertFormat, nodeIDQueryString, "TLS", "TLS", "", tlsDataPublisherEnabled ? 1 : 0));
database.Connection.ExecuteNonQuery(GEPDataPublisherInsertFormat, nodeIDQueryString, "TLS", "TLS", "", tlsDataPublisherEnabled ? 1 : 0);

if (sttpDataPublisherCount == 0)
database.Connection.ExecuteNonQuery(string.Format(STTPDataPublisherInsertFormat, nodeIDQueryString, "STTP", "None", "cachedMeasurementExpression={FILTER ActiveMeasurements WHERE SignalType = ''STAT''}", sttpDataPublisherEnabled ? 1 : 0));
database.Connection.ExecuteNonQuery(STTPDataPublisherInsertFormat, nodeIDQueryString, "STTP", "None", "cachedMeasurementExpression={FILTER ActiveMeasurements WHERE SignalType = ''STAT''}", sttpDataPublisherEnabled ? 1 : 0);

if (sttpsDataPublisherCount == 0)
database.Connection.ExecuteNonQuery(string.Format(STTPDataPublisherInsertFormat, nodeIDQueryString, "STTPS", "TLS", "", sttpsDataPublisherEnabled ? 1 : 0));
database.Connection.ExecuteNonQuery(STTPDataPublisherInsertFormat, nodeIDQueryString, "STTPS", "TLS", "", sttpsDataPublisherEnabled ? 1 : 0);
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Source/Libraries/GSF.TimeSeries/UI/DataModels/Adapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,8 @@ public static string Delete(AdoDataConnection database, AdapterType adapterType,
else
tableName = "CustomOutputAdapter";

string query = database.ParameterizedQueryString("DELETE FROM " + tableName + " WHERE ID = {0}", "adapterID");
database.Connection.ExecuteNonQuery(query, DefaultTimeout, adapterID);
string query = database.ParameterizedQueryString("DELETE FROM {1} WHERE ID = {0}", "adapterID", "tableName");
database.Connection.ExecuteNonQuery(query, DefaultTimeout, adapterID, tableName);

CommonFunctions.SendCommandToService("ReloadConfig");

Expand Down
3 changes: 1 addition & 2 deletions Source/Tools/CSVDataManager/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,7 @@ private void CopyCSVToMemSchema(Table dbTable)
.ToArray();

string tableFieldList = string.Join(",", tableFields);
string createTableSQL = $"CREATE TABLE {memTable.SQLEscapedName}({tableFieldList})";
MemSchema.Connection.ExecuteNonQuery(createTableSQL);
MemSchema.Connection.ExecuteNonQuery("CREATE TABLE {0}({1})", memTable.SQLEscapedName, tableFieldList);

// Modify the tableFieldList for INSERT statements
tableFields = memTable.Fields
Expand Down

0 comments on commit 2018a9e

Please sign in to comment.