-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Unused store procedures removed from application core.
- Loading branch information
Luis Lema
committed
Feb 16, 2020
1 parent
36e8bf6
commit e73948b
Showing
95 changed files
with
2,451 additions
and
142 deletions.
There are no files selected for viewing
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,16 @@ | ||
|
||
------------------------------------------------------------------------------ | ||
-- Create date: 2020-02-15 | ||
-- Autor: Luis Lema | ||
-- | ||
-- Description: | ||
-- Create database file for Firebird Engine. This database will be used to | ||
-- store configurations used by application. | ||
-- The name of this database depends of the name of application executable | ||
-- file plus .dat extension. | ||
------------------------------------------------------------------------------ | ||
|
||
CREATE DATABASE 'DATABASE_FILE_PATH\CONFIG.dat' | ||
USER 'SYSDBA' | ||
PAGE_SIZE = 4096 | ||
DEFAULT CHARACTER SET NONE; |
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,3 @@ | ||
/* Definition for the APPCONFIG_ID_GEN generator : */ | ||
|
||
CREATE GENERATOR APPCONFIG_ID_GEN; |
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,3 @@ | ||
/* Definition for the CONNSTR_ID_GEN generator : */ | ||
|
||
CREATE GENERATOR CONNSTR_ID_GEN; |
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,32 @@ | ||
/* Definition for the GET_STR procedure : */ | ||
|
||
------------------------------------------------------------------------------ | ||
-- Create date: 2020-02-15 | ||
-- Autor: Luis Lema | ||
-- | ||
-- Description: | ||
-- Get the value of a connection string. | ||
-- | ||
-- Parameters: | ||
-- IDKEY - The name of connection string, this value is unique across others. | ||
-- | ||
-- Returns: | ||
-- The value of connection string. | ||
------------------------------------------------------------------------------ | ||
|
||
CREATE OR ALTER PROCEDURE GET_STR | ||
( | ||
IDKEY TYPE OF COLUMN CONNSTR.IDKEY | ||
) | ||
RETURNS | ||
( | ||
VAL TYPE OF COLUMN CONNSTR.STR | ||
) | ||
AS | ||
BEGIN | ||
FOR SELECT STR FROM CONNSTR | ||
WHERE | ||
IDKEY=:IDKEY | ||
INTO :VAL | ||
DO SUSPEND; | ||
END |
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,33 @@ | ||
/* Definition for the GET_VALUE procedure : */ | ||
|
||
------------------------------------------------------------------------------ | ||
-- Create date: 2020-02-15 | ||
-- Autor: Luis Lema | ||
-- | ||
-- Description: | ||
-- Get the value of a configuration. | ||
-- | ||
-- Parameters: | ||
-- IDKEY - The name of configuration, this value is unique across others. | ||
-- | ||
-- Returns: | ||
-- The value of configuration. | ||
------------------------------------------------------------------------------ | ||
|
||
CREATE OR ALTER PROCEDURE GET_VALUE | ||
( | ||
IDKEY TYPE OF COLUMN APPCONFIG.IDKEY | ||
) | ||
RETURNS | ||
( | ||
RESULT TYPE OF COLUMN APPCONFIG.VAL | ||
) | ||
AS | ||
BEGIN | ||
FOR SELECT VAL FROM APPCONFIG | ||
WHERE | ||
IDKEY=:IDKEY | ||
INTO | ||
:RESULT | ||
DO SUSPEND; | ||
END |
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,25 @@ | ||
/* Definition for the SET_STR procedure : */ | ||
|
||
------------------------------------------------------------------------------ | ||
-- Create date: 2020-02-15 | ||
-- Autor: Luis Lema | ||
-- | ||
-- Description: | ||
-- Set the value of a connection string. | ||
-- | ||
-- Parameters: | ||
-- IDKEY - The name of connection string, this value is unique across others. | ||
-- VAL - The connections string. | ||
------------------------------------------------------------------------------ | ||
|
||
CREATE OR ALTER PROCEDURE SET_STR | ||
( | ||
IDKEY TYPE OF COLUMN CONNSTR.IDKEY, | ||
VAL TYPE OF COLUMN CONNSTR.STR | ||
) | ||
AS | ||
BEGIN | ||
UPDATE OR INSERT INTO CONNSTR(IDKEY,STR) | ||
VALUES(:IDKEY,:VAL) | ||
MATCHING(IDKEY); | ||
END |
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,23 @@ | ||
/* Definition for the SET_VALUE procedure : */ | ||
|
||
------------------------------------------------------------------------------ | ||
-- Create date: 2020-02-15 | ||
-- Autor: Luis Lema | ||
-- | ||
-- Description: | ||
-- Set the value of a configuration. | ||
-- | ||
-- Parameters: | ||
-- IDKEY - The name of configuration, this value is unique across others. | ||
-- VAL - The value. | ||
------------------------------------------------------------------------------ | ||
|
||
CREATE OR ALTER PROCEDURE SET_VALUE( | ||
IDKEY TYPE OF COLUMN APPCONFIG.IDKEY, | ||
VAL TYPE OF COLUMN APPCONFIG.VAL) | ||
AS | ||
BEGIN | ||
UPDATE OR INSERT INTO APPCONFIG(IDKEY,VAL) | ||
VALUES(:IDKEY,:VAL) | ||
MATCHING(IDKEY); | ||
END |
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,36 @@ | ||
/* Definition for the VERIFY_INITIALIZATION procedure : */ | ||
|
||
------------------------------------------------------------------------------ | ||
-- Create date: 2020-02-15 | ||
-- Autor: Luis Lema | ||
-- | ||
-- Description: | ||
-- Verify if configurations have been added. | ||
-- | ||
-- Returns: | ||
-- True if there are configurations otherwise false. | ||
------------------------------------------------------------------------------ | ||
|
||
CREATE OR ALTER PROCEDURE VERIFY_INITIALIZATION | ||
RETURNS | ||
( | ||
IS_INITIALIZED BOOLEAN | ||
) | ||
AS | ||
DECLARE VARIABLE COUNTER INT; | ||
BEGIN | ||
SELECT COUNT(1)FROM APPCONFIG | ||
INTO :COUNTER; | ||
|
||
COUNTER=COUNTER+(SELECT COUNT(1)FROM CONNSTR); | ||
|
||
IF(:COUNTER=0)THEN | ||
BEGIN | ||
:IS_INITIALIZED='FALSE'; | ||
END | ||
ELSE | ||
BEGIN | ||
:IS_INITIALIZED='TRUE'; | ||
END | ||
|
||
END |
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,9 @@ | ||
/* Structure for the APPCONFIG table : */ | ||
|
||
CREATE TABLE APPCONFIG ( | ||
ID INTEGER NOT NULL, | ||
IDKEY VARCHAR(190) NOT NULL, | ||
VAL BLOB); | ||
|
||
|
||
ALTER TABLE APPCONFIG ADD CONSTRAINT PK_APPCONFIG PRIMARY KEY (ID,IDKEY); |
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,8 @@ | ||
/* Structure for the CONNSTR table : */ | ||
|
||
CREATE TABLE CONNSTR ( | ||
ID INTEGER NOT NULL, | ||
IDKEY VARCHAR(190) NOT NULL, | ||
STR BLOB); | ||
|
||
ALTER TABLE CONNSTR ADD CONSTRAINT PK_CONNSTR PRIMARY KEY (ID,IDKEY); |
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,11 @@ | ||
/* Definition for the BI_APPCONFIG_ID trigger : */ | ||
|
||
CREATE TRIGGER BI_APPCONFIG_ID FOR APPCONFIG | ||
ACTIVE BEFORE | ||
INSERT | ||
POSITION 0 | ||
AS | ||
BEGIN | ||
IF (NEW.ID IS NULL) THEN | ||
NEW.ID = GEN_ID(APPCONFIG_ID_GEN, 1); | ||
END |
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,13 @@ | ||
/* Definition for the BI_CONNSTR_ID trigger : */ | ||
|
||
SET TERM ^ ; | ||
|
||
CREATE TRIGGER BI_CONNSTR_ID FOR CONNSTR | ||
ACTIVE BEFORE | ||
INSERT | ||
POSITION 0 | ||
AS | ||
BEGIN | ||
IF (NEW.ID IS NULL) THEN | ||
NEW.ID = GEN_ID(CONNSTR_ID_GEN, 1); | ||
END |
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,15 @@ | ||
|
||
------------------------------------------------------------------------------ | ||
-- Create date: 2020-02-15 | ||
-- Autor: Luis Lema | ||
-- | ||
-- Description: | ||
-- Create database file for Firebird Engine. This database will be used to | ||
-- store data used by application. | ||
-- The name of this database is E7FE8601FEAE and has a .KND extension. | ||
------------------------------------------------------------------------------ | ||
|
||
CREATE DATABASE 'DATABASE_FILE_PATH\E7FE8601FEAE.KND' | ||
USER 'SYSDBA' | ||
PAGE_SIZE = 4096 | ||
DEFAULT CHARACTER SET NONE; |
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,3 @@ | ||
/* Definition for the ACCOUNT_ID_GEN generator : */ | ||
|
||
CREATE GENERATOR ACCOUNT_ID_GEN; |
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,3 @@ | ||
/* Definition for the ANIMATION_ID_GEN generator : */ | ||
|
||
CREATE GENERATOR ANIMATION_ID_GEN; |
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,3 @@ | ||
/* Definition for the MESSAGE_FILE_ID_GEN generator : */ | ||
|
||
CREATE GENERATOR MESSAGE_FILE_ID_GEN; |
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,3 @@ | ||
/* Definition for the MESSAGE_ID_GEN generator : */ | ||
|
||
CREATE GENERATOR MESSAGE_ID_GEN; |
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,3 @@ | ||
/* Definition for the MESSAGE_TEXT_ID_GEN generator : */ | ||
|
||
CREATE GENERATOR MESSAGE_TEXT_ID_GEN; |
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,3 @@ | ||
/* Definition for the PEER_ADDRESS_ID_GEN generator : */ | ||
|
||
CREATE GENERATOR PEER_ADDRESS_ID_GEN; |
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,3 @@ | ||
/* Definition for the PEER_ID_GEN generator : */ | ||
|
||
CREATE GENERATOR PEER_ID_GEN; |
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,36 @@ | ||
/* Definition for the BULK_MARK_AS_READ_MESSAGE procedure : */ | ||
|
||
------------------------------------------------------------------------------ | ||
-- Create date: 2020-02-15 | ||
-- Autor: Luis Lema | ||
-- | ||
-- Description: | ||
-- Mark messages as read as a whole | ||
-- | ||
-- Parameters: | ||
-- LAST_MESSAGE_ID - The last message to be marked, all earlier ones | ||
-- will be marked too | ||
------------------------------------------------------------------------------ | ||
|
||
CREATE OR ALTER PROCEDURE BULK_MARK_AS_READ_MESSAGE | ||
( | ||
LAST_MESSAGE_ID TYPE OF COLUMN MESSAGE.ID | ||
) | ||
AS | ||
DECLARE VARIABLE ID_SENDER INTEGER; | ||
BEGIN | ||
ID_SENDER=(SELECT ID FROM MESSAGE WHERE ID=:LAST_MESSAGE_ID); | ||
|
||
UPDATE MESSAGE | ||
SET READ_STATE='TRUE' | ||
WHERE | ||
ID<=:LAST_MESSAGE_ID | ||
AND READ_STATE='FALSE'; | ||
|
||
DELETE FROM NOTIFICATION | ||
WHERE | ||
ID_TOKEN=:ID_SENDER | ||
AND PROCESSED='FALSE' | ||
AND TYPE_NOT=0; | ||
|
||
END |
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,15 @@ | ||
/* Definition for the CLEAR_NOTIFICATIONS procedure : */ | ||
|
||
------------------------------------------------------------------------------ | ||
-- Create date: 2020-02-15 | ||
-- Autor: Luis Lema | ||
-- | ||
-- Description: | ||
-- Deletes all notifications. | ||
------------------------------------------------------------------------------ | ||
|
||
CREATE OR ALTER PROCEDURE CLEAR_NOTIFICATIONS | ||
AS | ||
BEGIN | ||
DELETE FROM NOTIFICATION; | ||
END |
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,15 @@ | ||
/* Definition for the CLEAR_PARTIAL_MESSAGES procedure : */ | ||
|
||
------------------------------------------------------------------------------ | ||
-- Create date: 2020-02-15 | ||
-- Autor: Luis Lema | ||
-- | ||
-- Description: | ||
-- Deletes all messages fragments used when sending text messages. | ||
------------------------------------------------------------------------------ | ||
|
||
CREATE OR ALTER PROCEDURE CLEAR_PARTIAL_MESSAGES | ||
AS | ||
BEGIN | ||
DELETE FROM PARTIAL_MESSAGE; | ||
END |
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,16 @@ | ||
/* Definition for the CLEAR_PEERS procedure : */ | ||
|
||
------------------------------------------------------------------------------ | ||
-- Create date: 2020-02-15 | ||
-- Autor: Luis Lema | ||
-- | ||
-- Description: | ||
-- Deletes peer information like address, name and so on. | ||
------------------------------------------------------------------------------ | ||
|
||
CREATE OR ALTER PROCEDURE CLEAR_PEERS | ||
AS | ||
BEGIN | ||
DELETE FROM PEER_ADDRESS; | ||
DELETE FROM PEER; | ||
END |
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,16 @@ | ||
/* Definition for the CLEAR_PEER_STATE procedure : */ | ||
|
||
------------------------------------------------------------------------------ | ||
-- Create date: 2020-02-15 | ||
-- Autor: Luis Lema | ||
-- | ||
-- Description: | ||
-- Set all peers' state as offline | ||
------------------------------------------------------------------------------ | ||
|
||
CREATE OR ALTER PROCEDURE CLEAR_PEER_STATE | ||
AS | ||
BEGIN | ||
UPDATE PEER | ||
SET STATE=0; --Offline state | ||
END |
Oops, something went wrong.