Skip to content

Commit 10a9c0c

Browse files
committed
Rename GetTopicIDByUniqueKey to GetTopicID
Now that we've deleted the legacy (and flakey!) `GetTopicID` function in preference for the new(er) `GetTopicIDByUniqueKey` function, we can rename the `GetTopicIDByUniqueKey` to the unqualified name `GetTopicID`. This is a more intuitive name now that there's no longer a `GetTopicID` function (ff58a71). As part of this, updated the reference in `SqlTopicRepository`, the `GetTopics` stored procedure, as well as the `OnTopic.Data.Sql.Database` documentation (`README.md`).
1 parent ff58a71 commit 10a9c0c

5 files changed

Lines changed: 7 additions & 8 deletions

File tree

OnTopic.Data.Sql.Database/Functions/GetTopicIDByUniqueKey.sql renamed to OnTopic.Data.Sql.Database/Functions/GetTopicID.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
--------------------------------------------------------------------------------------------------------------------------------
2-
-- GET TOPIC ID BY UNIQUE KEY
2+
-- GET TOPIC ID
33
--------------------------------------------------------------------------------------------------------------------------------
44
-- Given a fully-qualified unique key, finds the TopicID associated with that key. Unlike [GetTopicID], this is guaranteed to
55
-- return an exclusive instance.
66
--------------------------------------------------------------------------------------------------------------------------------
77

88
CREATE
9-
FUNCTION [dbo].[GetTopicIDByUniqueKey]
9+
FUNCTION [dbo].[GetTopicID]
1010
(
1111
@UniqueKey NVARCHAR(2500)
1212
)

OnTopic.Data.Sql.Database/OnTopic.Data.Sql.Database.sqlproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@
8383
<Build Include="Utilities\Stored Procedures\DeleteOrphanedLastModifiedAttributes.sql" />
8484
<Build Include="Utilities\Stored Procedures\DeleteConsecutiveAttributes.sql" />
8585
<Build Include="Utilities\Stored Procedures\ConsolidateVersions.sql" />
86-
<Build Include="Functions\GetTopicIDByUniqueKey.sql" />
8786
<Build Include="Functions\GetExtendedAttribute.sql" />
8887
<Build Include="Functions\GetUniqueKey.sql" />
88+
<Build Include="Functions\GetTopicID.sql" />
8989
<Build Include="Utilities\Views\UniqueKeyIndex.sql" />
9090
<Build Include="Utilities\Views\LeftRightRange.sql" />
9191
<Build Include="Utilities\Tables\AdjacencyList.sql" />

OnTopic.Data.Sql.Database/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ The following is a summary of the most relevant stored procedures.
3636
- **[`UpdateRelationships`](Stored%20Procedures/UpdateRelationships.sql)**: Associates a relationship with a topic based on a `@TopicId`, `TopicList` array of `@Target_TopicIds`, and a `@RelationshipKey` (which can be any string label).
3737

3838
## Functions
39-
- **[`GetTopicID`](Functions/GetTopicID.sql)**: Retrieves a topic's `TopicId` based on a corresponding `@TopicKey`.
40-
- **[`GetTopicIDByUniqueKey`](Functions/GetTopicIDByUniqueKey.sql)**: Retrieves a topic's `TopicId` based on a corresponding `@UniqueKey` (e.g., `Root:Configuration`).
39+
- **[`GetTopicID`](Functions/GetTopicID.sql)**: Retrieves a topic's `TopicId` based on a corresponding `@UniqueKey` (e.g., `Root:Configuration`).
4140
- **[`GetUniqueKey`](Functions/GetUniqueKey.sql)**: Retrieves a topic's `UniqueKey` based on a corresponding `@TopicID`.
4241
- **[`GetParentID`](Functions/GetParentID.sql)**: Retrieves a topic's parent's `TopicID` based the child's `@TopicID`.
4342
- **[`GetAttributes`](functions/GetAttributes.sql)**: Given a `@TopicID`, provides the latest version of each attribute value from both `Attributes` and `ExtendedAttributes`, excluding key attributes (i.e., `Key`, `ContentType`, and `ParentID`).

OnTopic.Data.Sql.Database/Stored Procedures/GetTopics.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ AS
1616
--------------------------------------------------------------------------------------------------------------------------------
1717
IF @UniqueKey IS NOT NULL
1818
BEGIN
19-
SET @TopicID = dbo.GetTopicIDByUniqueKey(@UniqueKey)
19+
SET @TopicID = dbo.GetTopicID(@UniqueKey)
2020
END
2121

2222
IF @TopicID < 0
2323
BEGIN
24-
SET @TopicID = dbo.GetTopicIDByUniqueKey('Root')
24+
SET @TopicID = dbo.GetTopicID('Root')
2525
END
2626

2727
--------------------------------------------------------------------------------------------------------------------------------

OnTopic.Data.Sql/SqlTopicRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public override Topic Load(string? uniqueKey = null, bool isRecursive = true) {
7777
| Establish database connection
7878
\-----------------------------------------------------------------------------------------------------------------------*/
7979
using var connection = new SqlConnection(_connectionString);
80-
using var command = new SqlCommand("GetTopicIDByUniqueKey", connection);
80+
using var command = new SqlCommand("GetTopicID", connection);
8181

8282
var topicId = -1;
8383

0 commit comments

Comments
 (0)