-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1458 from hanbingleixue/develop
Fix the issue with testing the write prohibition function in OpenGauss and Postgresql databases
- Loading branch information
Showing
25 changed files
with
297 additions
and
728 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
...ontroller/src/main/java/com/huaweicloud/sermant/database/utils/ThreadDatabaseUrlUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright (C) 2023-2024 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.huaweicloud.sermant.database.utils; | ||
|
||
/** | ||
* Thread tool class, used for thread data transfer | ||
* | ||
* @author zhp | ||
* @since 2024-02-06 | ||
*/ | ||
public class ThreadDatabaseUrlUtil { | ||
/** | ||
* Thread variable storage, mainly storing database url information | ||
*/ | ||
private static final ThreadLocal<String> DATABASE_URL_THREAD_LOCAL = new InheritableThreadLocal<>(); | ||
|
||
/** | ||
* Constructor | ||
*/ | ||
private ThreadDatabaseUrlUtil() { | ||
} | ||
|
||
/** | ||
* Set database url information | ||
* | ||
* @param url Database url information | ||
*/ | ||
public static void setDatabaseUrl(String url) { | ||
DATABASE_URL_THREAD_LOCAL.set(url); | ||
} | ||
|
||
/** | ||
* Get database url information | ||
* | ||
* @return Database url information | ||
*/ | ||
public static String getDatabaseUrl() { | ||
return DATABASE_URL_THREAD_LOCAL.get(); | ||
} | ||
|
||
/** | ||
* Remove database url information | ||
*/ | ||
public static void removeDatabaseUrl() { | ||
DATABASE_URL_THREAD_LOCAL.remove(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 0 additions & 69 deletions
69
sermant-plugins/sermant-database-write-prohibition/opengauss-3.1.x-plugin/pom.xml
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
...c/main/java/com/huaweicloud/sermant/opengaussv31/declarers/QueryExecutorImplDeclarer.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.