Skip to content

Commit

Permalink
docs(er-view) + Subproject: Updated the table's view
Browse files Browse the repository at this point in the history
minor push submodules update.
  • Loading branch information
Ayon-SSP committed Apr 24, 2024
1 parent d372c65 commit 44ee3e9
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
/temp.md
/docs/Tables
/Guid.md
/.metadata
/Servers
2 changes: 1 addition & 1 deletion bookify-obms-console-app
Binary file added docs/OBMS-ER-Diagram-v2-VU.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/er-documentation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🛢️ Database Documentation

![OBMS-ER-dIAGRAM-V2](OBMS-ER-dIAGRAM-V2.png)
![OBMS-ER-dIAGRAM-V2](OBMS-ER-Diagram-v2-VU.png)
## 1. tbl_author
> Stores information about book authors.
Expand Down
44 changes: 44 additions & 0 deletions tests/db/auto-increment.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@


CREATE SEQUENCE BOOK_CATEGORY_SEQ
START WITH 1
INCREMENT BY 1;

CREATE OR REPLACE TRIGGER BOOK_CATEGORY_ID_TRIGGER BEFORE
INSERT ON BOOKCATEGORY FOR EACH ROW
BEGIN
SELECT
'bc'
|| TO_CHAR(BOOK_CATEGORY_SEQ.NEXTVAL, 'FM00000') INTO :NEW.CATEGORYID
FROM
DUAL;
END;
/

CREATE OR REPLACE PROCEDURE INSERT_BOOK_CATEGORY(
P_CATEGORY_NAME IN BOOKCATEGORY.CATEGORYNAME%TYPE,
P_CATEGORY_DESCRIPTION IN BOOKCATEGORY.CATEGORYDESCRIPTION%TYPE,
P_CATEGORY_IMAGE IN BOOKCATEGORY.CATEGORYIMAGE%TYPE,
P_NEW_ID OUT BOOKCATEGORY.CATEGORYID%TYPE
) AS
BEGIN
INSERT INTO BOOKCATEGORY (
CATEGORYNAME,
CATEGORYDESCRIPTION,
CATEGORYIMAGE
) VALUES (
P_CATEGORY_NAME,
P_CATEGORY_DESCRIPTION,
P_CATEGORY_IMAGE
) RETURNING CATEGORYID INTO P_NEW_ID;
END;
/


CallableStatement stmt = connection.prepareCall("{call insert_book_category(?, ?, ?, ?)}");
stmt.setString(1, categoryName);
stmt.setString(2, categoryDescription);
stmt.setString(3, categoryImage);
stmt.registerOutParameter(4, Types.VARCHAR);
stmt.execute();
String newId = stmt.getString(4);

0 comments on commit 44ee3e9

Please sign in to comment.