Skip to content

Commit

Permalink
OutputStream
Browse files Browse the repository at this point in the history
  • Loading branch information
collins-self committed Dec 17, 2024
1 parent 8918096 commit 44d6753
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -829,13 +829,13 @@ public static IList<int> LoadKeys(AdoDataConnection database, bool enabledOnly,

if (enabledOnly)
{
query = database.ParameterizedQueryString($"SELECT ID FROM OutputStreamDetail WHERE NodeID = {{0}} AND Enabled = {{1}} {sortClause}", "nodeID", "enabled");
outputStreamTable = database.Connection.RetrieveData(database.AdapterType, query, database.CurrentNodeID(), database.Bool(true));
query = database.ParameterizedQueryString("SELECT ID FROM OutputStreamDetail WHERE NodeID = {0} AND Enabled = {1} {2}", "nodeID", "enabled", "sortClause");
outputStreamTable = database.Connection.RetrieveData(database.AdapterType, query, database.CurrentNodeID(), database.Bool(true), sortClause);
}
else
{
query = database.ParameterizedQueryString($"SELECT * FROM OutputStreamDetail WHERE NodeID = {{0}} {sortClause}", "nodeID");
outputStreamTable = database.Connection.RetrieveData(database.AdapterType, query, database.CurrentNodeID());
query = database.ParameterizedQueryString("SELECT * FROM OutputStreamDetail WHERE NodeID = {0} {1}", "nodeID", "sortClause");
outputStreamTable = database.Connection.RetrieveData(database.AdapterType, query, database.CurrentNodeID(), sortClause);
}

foreach (DataRow row in outputStreamTable.Rows)
Expand Down Expand Up @@ -871,8 +871,7 @@ public static ObservableCollection<OutputStream> Load(AdoDataConnection database
if (keys is not null && keys.Count > 0)
{
string commaSeparatedKeys = keys.Select(key => $"{key}").Aggregate((str1, str2) => $"{str1},{str2}");
string query = $"SELECT * FROM OutputStreamDetail WHERE ID IN ({commaSeparatedKeys})";
DataTable outputStreamTable = database.Connection.RetrieveData(database.AdapterType, query, DefaultTimeout);
DataTable outputStreamTable = database.Connection.RetrieveData(database.AdapterType, "SELECT * FROM OutputStreamDetail WHERE ID IN ({0})", DefaultTimeout, commaSeparatedKeys);

outputStreamList = new ObservableCollection<OutputStream>(
from item in outputStreamTable.AsEnumerable()
Expand Down Expand Up @@ -1041,7 +1040,7 @@ public static string Save(AdoDataConnection database, OutputStream outputStream,

if (qualityType is not null)
{
IList<int> keys = database.Connection.RetrieveData(database.AdapterType, $"SELECT ID FROM OutputStreamMeasurement WHERE AdapterID = {outputStream.ID}")
IList<int> keys = database.Connection.RetrieveData(database.AdapterType, "SELECT ID FROM OutputStreamMeasurement WHERE AdapterID = {0}", outputStream.ID)
.Select().Select(row => row.ConvertField<int>("ID")).ToList();

foreach (OutputStreamMeasurement measurement in OutputStreamMeasurement.Load(database, keys))
Expand Down Expand Up @@ -1165,7 +1164,7 @@ public static OutputStream GetOutputStream(AdoDataConnection database, string wh
try
{
createdConnection = CreateConnection(ref database);
DataTable outputStreamTable = database.Connection.RetrieveData(database.AdapterType, $"SELECT * FROM OutputStreamDetail {whereClause}");
DataTable outputStreamTable = database.Connection.RetrieveData(database.AdapterType, "SELECT * FROM OutputStreamDetail {0}", whereClause);

if (outputStreamTable.Rows.Count == 0)
return null;
Expand Down

0 comments on commit 44d6753

Please sign in to comment.