[Greater-commits] r287 - trunk/GREAT-ER-DB/impl/postgresql
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Jun 27 17:47:40 CEST 2011
Author: bricks
Date: 2011-06-27 17:47:40 +0200 (Mon, 27 Jun 2011)
New Revision: 287
Modified:
trunk/GREAT-ER-DB/impl/postgresql/gdagreater_pg.pgc
Log:
Where greater specific tables are selected use uppercase letters for username.
If the username is used in any postgres specific context use always lowercase.
Fix indentation
Modified: trunk/GREAT-ER-DB/impl/postgresql/gdagreater_pg.pgc
===================================================================
--- trunk/GREAT-ER-DB/impl/postgresql/gdagreater_pg.pgc 2011-06-27 15:46:03 UTC (rev 286)
+++ trunk/GREAT-ER-DB/impl/postgresql/gdagreater_pg.pgc 2011-06-27 15:47:40 UTC (rev 287)
@@ -4205,9 +4205,9 @@
\return Database connection (DB_con*) or NULL.
*/
DB_con * gda_db_connect_admin(char *vp_userid,
- char *vp_passwd,
+ char *vp_passwd,
char *vp_connect_descr,
- int *vp_admin,
+ int *vp_admin,
DA_T_errinfo *vp_errinfo)
{
DA_T_MODULE_NAME v_module = "gda_db_connect_admin";
@@ -4220,8 +4220,8 @@
long h_group_id;
long h_count;
char h_user_id [ 31];
- char h_con_name [ 31];
- char dbname [ 31];
+ char h_con_name [ 31];
+ char dbname [ 31];
char h_usrid_passwd[240];
short int h_ind_user_id;
@@ -4229,11 +4229,11 @@
db_con = malloc(sizeof(DB_con));
- if(!db_con)
+ if(!db_con)
return (DA_FAIL);
lgda_set_connection_values(db_con, vp_connect_descr,
- vp_userid, vp_passwd, vp_errinfo);
+ vp_userid, vp_passwd, vp_errinfo);
/* Initialise admin flag */
@@ -4272,7 +4272,7 @@
if (!ECPGstatus(__LINE__, db_con->con_name))
{
- return(NULL);
+ return(NULL);
}
/* check if connected user is a valid GREAT-ER user and in case
@@ -4296,21 +4296,22 @@
EXEC SQL SELECT GROUP_ID
INTO :h_group_id
FROM USER_TAB
- WHERE USER_ID = LOWER(:h_user_id);
+ WHERE USER_ID = UPPER(:h_user_id);
strcpy(vg_db_user_info.user_id, h_user_id);
vg_db_user_info.group_id = h_group_id;
vg_db_user_info.admin = 0;
errln = 50;
- /* Analogon zu Oracle-Version */
+ /* Analog to Oracle version
+ * check if user can access catch_tab
+ */
EXEC SQL SELECT COUNT(c.relname)
- INTO :h_count
- FROM pg_class c LEFT JOIN pg_user u ON c.relowner = u.usesysid
- where c.relkind IN ('r','')
- AND c.relname !~ '^pg_'
- AND u.usename = LOWER(:h_user_id)
- AND c.relname = 'catch_tab';
+ INTO :h_count
+ FROM pg_class c LEFT JOIN pg_user u ON c.relowner = u.usesysid
+ WHERE c.relkind IN ('r','')
+ AND u.usename = LOWER(:h_user_id)
+ AND c.relname = 'catch_tab';
if (NULL)
{
More information about the Greater-commits
mailing list