Files
documentdb/pg_documentdb/sql/udfs/schema_mgmt/drop_database--latest.sql
T
Sena Gungor f27742a288 Merged PR 1477339: Add initial structure for documentation with comments on functions
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Docs
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description

This PR includes updates to add base Doxygen comments within SQL files, setting up initial documentation structure for functions. Additionally, it includes Doxygen configuration files (Doxyfile, etc.) tailored to support SQL file parsing and documentation generation.

----
#### AI description  (iteration 1)
#### PR Classification
Documentation

#### PR Summary
This pull request adds Doxygen comments to various `helio_api` functions to improve code documentation.
- Added Doxygen comments to functions in `sql/udfs/commands_crud/query_cursors_single_page--latest.sql`
- Added Doxygen comments to functions in `sql/udfs/utils/extension_version_utils--latest.sql`
- Added Doxygen comments to functions in `sql/udfs/auth/auth_scram--latest.sql`
- Added Doxygen comments to functions in `sql/udfs/commands_crud/delete--latest.sql`
- Added Doxygen comments to functions in `sql/udfs/schema_mgmt/create_collection_view--latest.sql`
2025-01-27 14:50:58 -08:00

53 lines
1.7 KiB
PL/PgSQL

/* db.dropDatabase(writeConcern) */
/**
* @ingroup schema_mgmt
* @brief Drops an existing database from the DocumentDB system.
*
* @details This function removes the specified database and all collections within it. Optionally,
* a write concern can be provided to control the behavior of the drop operation.
* The function performs a loop to drop each collection associated with the database before
* removing the database itself.
*
* **Usage Examples:**
* - Drop a database:
* ```sql
* SELECT documentdb_api.drop_database('hr_database');
* -- Returns:
* --
* ```
*
* @param[in] p_database_name Name of the target database to drop. Must not be NULL.
* @param[in] p_write_concern (Optional) BSON object specifying the write concern for the operation.
* Defaults to NULL.
*
* **Returns:**
* - Void if the database is dropped successfully.
* - An error if the operation fails.
*/
CREATE OR REPLACE FUNCTION __API_SCHEMA_V2__.drop_database(
p_database_name text,
p_write_concern __CORE_SCHEMA_V2__.bson default null)
RETURNS void
SET search_path TO __CORE_SCHEMA_V2__, pg_catalog
AS $fn$
DECLARE
v_collection record;
BEGIN
/* TODO: lock on database to prevent concurrent table addition */
FOR
v_collection
IN
SELECT
database_name, collection_name
FROM
__API_CATALOG_SCHEMA__.collections
WHERE
database_name = p_database_name
LOOP
PERFORM __API_SCHEMA_V2__.drop_collection(v_collection.database_name, v_collection.collection_name);
END LOOP;
END;
$fn$ LANGUAGE plpgsql;
COMMENT ON FUNCTION __API_SCHEMA_V2__.drop_database(text,__CORE_SCHEMA_V2__.bson)
IS 'drop a mongo database';