diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-11-01 04:32:48 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-11-01 04:32:48 +0000 |
commit | b2b02c07bf6e37c45bcb72d6414a2e1c16313251 (patch) | |
tree | c07a14acc2ec325d01d7c517dae363dbe276c80e /utils | |
parent | 3d9f71125b3f9e008ec953a669953fc4e65fc991 (diff) |
Removing utils/custom_fields since that works in the main tree
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@444 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'utils')
-rw-r--r-- | utils/custom_fields/custom_fields.sql | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/utils/custom_fields/custom_fields.sql b/utils/custom_fields/custom_fields.sql deleted file mode 100644 index 0ee4290b..00000000 --- a/utils/custom_fields/custom_fields.sql +++ /dev/null @@ -1,47 +0,0 @@ - -CREATE OR REPLACE FUNCTION add_custom_field (VARCHAR, VARCHAR, VARCHAR) -RETURNS BOOL AS -' -DECLARE -table_name ALIAS FOR $1; -new_field_name ALIAS FOR $2; -field_datatype ALIAS FOR $3; - -BEGIN - EXECUTE ''SELECT TABLE_ID FROM custom_table_catalog - WHERE extends = '''''' || table_name || '''''' ''; - IF NOT FOUND THEN - BEGIN - INSERT INTO custom_table_catalog (extends) - VALUES (table_name); - EXECUTE ''CREATE TABLE custom_''||table_name || - '' (row_id INT)''; - EXCEPTION WHEN duplicate_table THEN - -- do nothing - END; - END IF; - EXECUTE ''INSERT INTO custom_field_catalog (field_name, table_id) - VALUES ( '''''' || new_field_name ||'''''', (SELECT table_id FROM custom_table_catalog - WHERE extends = ''''''|| table_name || ''''''))''; - EXECUTE ''ALTER TABLE custom_''||table_name || '' ADD COLUMN '' - || new_field_name || '' '' || field_datatype; - RETURN TRUE; -END; -' LANGUAGE PLPGSQL; - -CREATE OR REPLACE FUNCTION drop_custom_field (VARCHAR, VARCHAR) -RETURNS BOOL AS -' -DECLARE -table_name ALIAS FOR $1; -custom_field_name ALIAS FOR $2; -BEGIN - DELETE FROM custom_field_catalog - WHERE field_name = custom_field_name AND - table_id = (SELECT table_id FROM custom_table_catalog - WHERE extends = table_name); - EXECUTE ''ALTER TABLE custom_'' || table_name || - '' DROP COLUMN '' || custom_field_name; - RETURN TRUE; -END; -' LANGUAGE PLPGSQL; |