/// <summary> /// Creates a command to peform a study-level query /// </summary> /// <param name="command">IDbCommand that is created</param> /// <param name="matchingParamsCollection">Contains the query parameters that are used to generate the WHERE statement</param> protected override void PrepareStudiesQueryCommand ( IDbCommand command, Collection <CatalogElement[]> matchingParamsCollection, ExtraQueryOptions extraQueryOptions ) { //if (MaxQueryResults > 0) //{ // base.PrepareStudiesQueryCommand(command, matchingParamsCollection, extraQueryOptions); //} //else { command.CommandText = MyGetStudiesCommandText(matchingParamsCollection); command.CommandType = CommandType.Text; } }
/// <summary> /// Returns a list containing the all tables names in the database /// </summary> /// <param name="dataset">The strongly typed DataSet that corresponds to the custom database (i.e. MyDicomDataSet)</param> /// <returns> /// A list containing the all tables names in the database /// </returns> protected override string[] GetCompositeInstanceQueryDataAdapterTables(DataSet dataset, ExtraQueryOptions extraQueryOptions) { MyDataSet myDataSet = new MyDataSet(); myDataSet.Merge(dataset); try { List <string> instanceQueryTables = new List <string>(); //Patient entity mapping instanceQueryTables.Add(myDataSet.MyPatientTable.TableName); //Study entity mapping instanceQueryTables.Add(myDataSet.MyStudyTable.TableName); //Series entity mapping instanceQueryTables.Add(myDataSet.MySeriesTable.TableName); //Image entity mapping instanceQueryTables.Add(myDataSet.MyInstanceTable.TableName); return(instanceQueryTables.ToArray()); } catch (Exception exception) { System.Diagnostics.Debug.WriteLine(exception.Message); System.Diagnostics.Debug.Assert(false); throw; } }
/// <summary> /// Creates a command to delete rows of the 'instance' table based on the search criteria specified in the matchingParamsCollection /// </summary> /// <param name="command">IDbCommand that is created</param> /// <param name="matchingParamsCollection">Contains the query parameters that are used to generate the WHERE statement</param> protected override void PrepareDeleteInstanceCommand(IDbCommand command, Collection <CatalogElement[]> matchingParametersCollection, ExtraQueryOptions extraQueryOptions) { command.CommandText = MyGetDeleteCommandText(matchingParametersCollection, MyConstants.DeleteCommandText.FromInstance); command.CommandType = CommandType.Text; }
/// <summary> /// Creates a command that returns a count of instance rows matching the search criteria specified in the matchingParamsCollection /// </summary> /// <param name="command">IDbCommand that is created</param> /// <param name="matchingParamsCollection">Contains the query parameters that are used to generate the WHERE statement</param> protected override void PrepareInstanceQueryCountCommand(IDbCommand command, Collection <CatalogElement[]> matchingParamsCollection, ExtraQueryOptions extraQueryOptions) { if (IsNoTableSpecifiedInParams(matchingParamsCollection)) { command.CommandText = string.Format(MySqlStatments.SqlSpecificSelectCount, "MyInstanceTable"); } else { StringBuilder sb = new StringBuilder(500); sb.Append(MyConstants.SelectCommandText.FirstPart); sb.Append(MyConstants.SelectCommandText.FromClause.Image); sb.Append(SqlProviderUtilities.GenerateWhereStatement(matchingParamsCollection)); sb.Append(MyConstants.SelectCommandText.MIDDLE_PART); sb.Append(string.Format(MySqlStatments.InstanceEntitySelect.InstanceCount, MyConstants.PrimaryKeyTableName)); sb.Append(MyConstants.SelectCommandText.LAST_PART); command.CommandText = sb.ToString( ); } }
/// <summary> /// Creates a command that returns a count of series rows matching the search criteria specified in the matchingParamsCollection /// </summary> /// <param name="command">IDbCommand that is created</param> /// <param name="matchingParamsCollection">Contains the query parameters that are used to generate the WHERE statement</param> protected override void PrepareSeriesQueryCountCommand(IDbCommand command, Collection <CatalogElement[]> matchingParamsCollection, ExtraQueryOptions extraQueryOptions) { command.CommandText = string.Format(MySqlStatments.SqlSpecificSelectCount, "MySeriesTable"); }
/// <summary> /// Creates a command to peform an instance-level query /// </summary> /// <param name="command">IDbCommand that is created</param> /// <param name="matchingParamsCollection">Contains the query parameters that are used to generate the WHERE statement</param> protected override void PrepareInstanceQueryCommand(IDbCommand command, Collection <CatalogElement[]> matchingParamsCollection, ExtraQueryOptions extraQueryOptions) { command.CommandText = "exec sp_executeSQL @CMD"; //if (MaxQueryResults > 0) //{ // base.PrepareInstanceQueryCommand(command, matchingParamsCollection, extraQueryOptions); //} //else { string cmdText = GetInstanceCommandText(matchingParamsCollection, null); command.Parameters.Add(new SqlParameter("@CMD", cmdText)); command.CommandType = CommandType.Text; } }