summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlinuxpoet <linuxpoet@4979c152-3d1c-0410-bac9-87ea11338e46>2006-10-24 01:13:19 +0000
committerlinuxpoet <linuxpoet@4979c152-3d1c-0410-bac9-87ea11338e46>2006-10-24 01:13:19 +0000
commit0fdca403744d98232bf332d2a72ae69d6a23312b (patch)
treef65d295f7fb3e84cddda10b74c1cb3613dd22f7f
parent29a8cd2abffc6a422142cef31961e316441d42f7 (diff)
changed create_user to return users.id if successful
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@275 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-xsql/Pg-tables.sql4
-rw-r--r--sql/Pg-upgrade-2.6.18-2.6.19.sql4
2 files changed, 4 insertions, 4 deletions
diff --git a/sql/Pg-tables.sql b/sql/Pg-tables.sql
index 5201e55e..c9771e4d 100755
--- a/sql/Pg-tables.sql
+++ b/sql/Pg-tables.sql
@@ -761,10 +761,10 @@ INSERT INTO users_conf(id,password) VALUES (currval('users_id_seq'),NULL);
CREATE FUNCTION create_user(text) RETURNS int4 AS $$
INSERT INTO users(username) VALUES ('$1');
- SELECT 1;
+ SELECT currval('user_id_seq');
$$ LANGUAGE 'SQL';
-COMMENT ON FUNCTION create_user(text) IS $$ Function to create user. Returns 1 if successful, else it is an error. $$;
+COMMENT ON FUNCTION create_user(text) IS $$ Function to create user. Returns users.id if successful, else it is an error. $$;
CREATE FUNCTION update_user(int4,text) RETURNS int4 AS $$
UPDATE users SET username = '$2' WHERE id = $1;
diff --git a/sql/Pg-upgrade-2.6.18-2.6.19.sql b/sql/Pg-upgrade-2.6.18-2.6.19.sql
index ce34ab29..924bd0ba 100644
--- a/sql/Pg-upgrade-2.6.18-2.6.19.sql
+++ b/sql/Pg-upgrade-2.6.18-2.6.19.sql
@@ -195,10 +195,10 @@ COMMIT;
CREATE FUNCTION create_user(text) RETURNS int4 AS $$
INSERT INTO users(username) VALUES ('$1');
- SELECT 1;
+ SELECT currval('user_id_seq');
$$ LANGUAGE 'SQL';
-COMMENT ON FUNCTION create_user(text) IS $$ Function to create user Returns 1 if successful, else it is an error. $$;
+COMMENT ON FUNCTION create_user(text) IS $$ Function to create user Returns users.id if successful, else it is an error. $$;
CREATE FUNCTION update_user(int4,text) RETURNS int4 AS $$
UPDATE users SET username = '$2' WHERE id = $1;