[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [275] trunk/sql



Revision: 275
          http://svn.sourceforge.net/ledger-smb/?rev=275&view=rev
Author:   linuxpoet
Date:     2006-10-23 18:13:19 -0700 (Mon, 23 Oct 2006)

Log Message:
-----------
changed create_user to return users.id if successful

Modified Paths:
--------------
    trunk/sql/Pg-tables.sql
    trunk/sql/Pg-upgrade-2.6.18-2.6.19.sql

Modified: trunk/sql/Pg-tables.sql
===================================================================
--- trunk/sql/Pg-tables.sql	2006-10-24 01:01:52 UTC (rev 274)
+++ trunk/sql/Pg-tables.sql	2006-10-24 01:13:19 UTC (rev 275)
@@ -761,10 +761,10 @@
 
 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;

Modified: trunk/sql/Pg-upgrade-2.6.18-2.6.19.sql
===================================================================
--- trunk/sql/Pg-upgrade-2.6.18-2.6.19.sql	2006-10-24 01:01:52 UTC (rev 274)
+++ trunk/sql/Pg-upgrade-2.6.18-2.6.19.sql	2006-10-24 01:13:19 UTC (rev 275)
@@ -195,10 +195,10 @@
 
 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;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.