[Greater-commits] r301 - trunk/GREAT-ER-DB/impl/postgresql
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Jun 29 12:56:02 CEST 2011
Author: bricks
Date: 2011-06-29 12:56:01 +0200 (Wed, 29 Jun 2011)
New Revision: 301
Modified:
trunk/GREAT-ER-DB/impl/postgresql/gdagreater_pg.pgc
Log:
Store uppercase user in h_user_id in gda_connect_admin function because our user is uppercase in all db tables
fix indentation
Modified: trunk/GREAT-ER-DB/impl/postgresql/gdagreater_pg.pgc
===================================================================
--- trunk/GREAT-ER-DB/impl/postgresql/gdagreater_pg.pgc 2011-06-29 10:44:02 UTC (rev 300)
+++ trunk/GREAT-ER-DB/impl/postgresql/gdagreater_pg.pgc 2011-06-29 10:56:01 UTC (rev 301)
@@ -4284,14 +4284,11 @@
errln = 20;
EXEC SQL WHENEVER NOT FOUND GOTO not_a_valid_user;
-/*
- * Statement disabled because it makes no sence if the user
- * is not a user and could not be connected we woudl not be here
errln = 30;
EXEC SQL SELECT UPPER(:h_user_id)
INTO :h_user_id INDICATOR :h_ind_user_id;
-*/
+
errln = 40;
EXEC SQL SELECT GROUP_ID
INTO :h_group_id
@@ -4686,7 +4683,7 @@
strcpy(h_con_name, db_con->con_name);
sprintf(sql_statement, "ALTER USER %s IDENTIFIED BY %s",
h_user_id, h_passwd);
-
+
/* set the current db connection */
EXEC SQL SET CONNECTION TO :h_con_name;
@@ -11822,17 +11819,17 @@
"NAME,"
"USER_ID,"
"to_char(CRE_DATE, '%s'), "
- "to_char(MOD_DATE, '%s'), "
+ "to_char(MOD_DATE, '%s'), "
"STATUS,"
"PRIVS,"
"IS_TEMP_SESS,"
"TEMP_SESS_SRC_ID,"
"TEMP_SESS_DB_SID,"
- "REMARK "
- "FROM SESS_TAB "
- "WHERE %s IS_TEMP_SESS LIKE '%s' "
- "ORDER BY SESS_ID",
- h_fmt_date, h_fmt_date, h_where_clause, h_is_temp_sess);
+ "REMARK "
+ "FROM SESS_TAB "
+ "WHERE %s IS_TEMP_SESS LIKE '%s' "
+ "ORDER BY SESS_ID",
+ h_fmt_date, h_fmt_date, h_where_clause, h_is_temp_sess);
EXEC SQL PREPARE get_state FROM :h_query;
@@ -12928,7 +12925,7 @@
INTO :h_sess INDICATOR :h_ind_sess
FROM SESS_TAB
WHERE SESS_ID = :h_sess_id_src;
-
+
/* check indicator variables (in regard to NULL values) */
if (h_ind_sess.sess_id == -1) h_sess.sess_id = -1;
if (h_ind_sess.catch_id == -1) h_sess.catch_id = -1;
@@ -12941,7 +12938,7 @@
if (h_ind_sess.privs == -1) h_sess.privs = 1;
if (h_ind_sess.temp_sess_src_id == -1) h_sess.temp_sess_src_id = -1;
if (h_ind_sess.temp_sess_db_sid == -1) h_sess.temp_sess_db_sid = -1;
-
+
if (h_ind_sess.name == -1) strcpy(h_sess.name, "");
if (h_ind_sess.user_id == -1) strcpy(h_sess.user_id, "");
if (h_ind_sess.cre_date == -1) strcpy(h_sess.cre_date, "");
@@ -12949,7 +12946,7 @@
if (h_ind_sess.status == -1) strcpy(h_sess.status, "");
if (h_ind_sess.is_temp_sess == -1) strcpy(h_sess.is_temp_sess, "N");
if (h_ind_sess.remark == -1) strcpy(h_sess.remark, "");
-
+
/* copy result into temp. buffer */
v_sess_buf.sess_id = h_sess.sess_id;
v_sess_buf.catch_id = h_sess.catch_id;
@@ -12991,15 +12988,15 @@
v_status = lgda_get_access_right(DA_A_SESS_TAB, (void*) &v_sess_buf,
&v_access_right, vp_errinfo);
}
-
+
if ((v_access_right >= DA_A_VIEW) && (v_status == DA_SUCCESS))
- {
+ {
/*
* Start to create temp. session
*/
if (h_sess.subst_id != -1)
- {
+ {
/* --------------------------------------------------- *
* Copy SUBSTANCE data (SUBST_TAB/SUBST_DET_TAB)
* --------------------------------------------------- */
@@ -13107,7 +13104,7 @@
}
if (h_sess.market_id != -1)
- {
+ {
/* --------------------------------------------------- *
* Copy MARKET data (MARKET_TAB)
* --------------------------------------------------- */
@@ -13131,10 +13128,9 @@
/* set new MARKET_ID in SESSION data */
h_sess.market_id = h_market_id_new;
- }
-
+ }
if (h_sess.res_id != -1)
- {
+ {
/* --------------------------------------------------- *
* Copy RESULT data (RES_..._TAB)
* --------------------------------------------------- */
@@ -13154,9 +13150,9 @@
WHERE RES_ID = :h_sess.res_id;
errln = 210;
EXEC SQL WHENEVER NOT FOUND CONTINUE;
-
- errln = 220;
- v_object_id = h_sess.res_id;
+
+ errln = 220;
+ v_object_id = h_sess.res_id;
if (gda_get_bin_obj(db_con,
v_object_id,
v_object_type,
@@ -13172,26 +13168,24 @@
/* set new RES_ID for binary result detail data */
errln = 230;
- while (v_bin_obj_cur != 0)
- {
- v_bin_obj_cur->object_id = h_res_id_new;
- if (!gda_insert_bin_obj(db_con, v_bin_obj_cur, vp_errinfo))
- {
+ while (v_bin_obj_cur != 0)
+ {
+ v_bin_obj_cur->object_id = h_res_id_new;
+ if (!gda_insert_bin_obj(db_con, v_bin_obj_cur, vp_errinfo))
+ {
+ /* --------------------------------------------------------- *
+ * Error during INSERT of binary results
+ * --------------------------------------------------------- */
+ /* set error info */
+ sprintf (vp_errinfo->err_param,"%s - %s", vp_errinfo->err_param, v_module);
- /* --------------------------------------------------------- *
- * Error during INSERT of binary results
- * --------------------------------------------------------- */
- /* set error info */
- sprintf (vp_errinfo->err_param,"%s - %s", vp_errinfo->err_param, v_module);
-
- /* record not inserted */
- return(DA_FAIL);
-
- }
- v_bin_obj_cur = v_bin_obj_cur->next_element;
- i++;
- }
- }
+ /* record not inserted */
+ return(DA_FAIL);
+ }
+ v_bin_obj_cur = v_bin_obj_cur->next_element;
+ i++;
+ }
+ }
}
else
{
@@ -13206,10 +13200,10 @@
}
/* set new RES_ID in SESSION data */
h_sess.res_id = h_res_id_new;
- }
+ }
if (h_sess.sess_disch_id != -1)
- {
+ {
/* --------------------------------------------------- *
* Copy SESS_DISCH data (SESS_DISCH_TAB)
* --------------------------------------------------- */
@@ -13239,7 +13233,7 @@
/* set new SESS_DISCH_ID in SESSION data */
h_sess.sess_disch_id = h_sess_disch_id_new;
- }
+ }
/* ------------------------------------------------------- *
@@ -13249,25 +13243,25 @@
/* get new SESSION-ID */
errln = 270;
- if (vp_sess_id_src == -1)
- {
+ if (vp_sess_id_src == -1)
+ {
EXEC SQL SELECT NEXTVAL('SESS_SEQ'),
to_char(CURRENT_TIMESTAMP, :h_fmt_date),
to_char(CURRENT_TIMESTAMP, :h_fmt_date)
INTO :h_sess_id_new,
:h_sess.cre_date,
:h_sess.mod_date;
- }
- else
- {
- EXEC SQL SELECT NEXTVAL('SESS_SEQ'),
+ }
+ else
+ {
+ EXEC SQL SELECT NEXTVAL('SESS_SEQ'),
to_char(CURRENT_TIMESTAMP, :h_fmt_date)
INTO :h_sess_id_new,
:h_sess.mod_date;
- }
+ }
- /* Take parameter as temp type */
- h_sess.is_temp_sess[0]=vp_temp_type;
+ /* Take parameter as temp type */
+ h_sess.is_temp_sess[0]=vp_temp_type;
h_sess.is_temp_sess[1]='\0';
errln = 280;
@@ -13307,8 +13301,8 @@
:h_sess.remark);
EXEC SQL SELECT SESS_ID INTO :h_sess.temp_sess_db_sid FROM SESS_TAB WHERE SESS_ID = :h_sess_id_new;
- EXEC SQL UPDATE SESS_TAB SET TEMP_SESS_DB_SID = :h_sess.temp_sess_db_sid
- WHERE SESS_ID = :h_sess_id_new ;
+ EXEC SQL UPDATE SESS_TAB SET TEMP_SESS_DB_SID = :h_sess.temp_sess_db_sid
+ WHERE SESS_ID = :h_sess_id_new;
/* set return value (SESS_ID,... of created temp. session) */
h_sess.sess_id = h_sess_id_new;
@@ -13317,7 +13311,7 @@
/* record successfully inserted */
return(v_status);
- }
+ }
else
{
/* --------------------------------------------------------- *
@@ -13631,13 +13625,13 @@
Output:
<li>vp_errinfo - Error info in case of error occured
-
+
\author T.V. - TechniData AG/Markdorf \n H.K. - Intevation
-
+
\date 16-AUG-2002
\param db_con Pointer to connection
-
+
\return DA_SUCCESS \n DA_FAIL
*/
int gda_cleanup_temp_sess(DB_con *db_con, DA_T_errinfo *vp_errinfo)
More information about the Greater-commits
mailing list