[Greater-commits] r236 - trunk/GREAT-ER-DB/impl/postgresql
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Jun 22 12:32:07 CEST 2011
Author: aheinecke
Date: 2011-06-22 12:32:05 +0200 (Wed, 22 Jun 2011)
New Revision: 236
Modified:
trunk/GREAT-ER-DB/impl/postgresql/gdagreater_pg.pgc
Log:
Revert revision 214 which raised the limit on source fields while
ignoring the target fields
Modified: trunk/GREAT-ER-DB/impl/postgresql/gdagreater_pg.pgc
===================================================================
--- trunk/GREAT-ER-DB/impl/postgresql/gdagreater_pg.pgc 2011-06-22 10:03:54 UTC (rev 235)
+++ trunk/GREAT-ER-DB/impl/postgresql/gdagreater_pg.pgc 2011-06-22 10:32:05 UTC (rev 236)
@@ -4021,7 +4021,7 @@
*
* Globals : errln
* vg_db_user_info
-*
+*
* Changes :
* [DD-MON-YYYY] - [ Name ] - [ Action ]
*********************************************************************/
@@ -4032,7 +4032,7 @@
\li vp_errinfo Error info in case error occured
\author H.Korte - Intevation
-
+
\date 09-SEP-2003
\param vp_userid user-id of database user
@@ -4041,10 +4041,10 @@
\return Database connection (DB_con*) or NULL.
*/
-DB_con* gda_db_connect(char *vp_userid,
- char *vp_passwd,
- char *vp_connect_descr,
- DA_T_errinfo *vp_errinfo)
+DB_con* gda_db_connect(char *vp_userid,
+ char *vp_passwd,
+ char *vp_connect_descr,
+ DA_T_errinfo *vp_errinfo)
{
DA_T_MODULE_NAME v_module = "gda_db_connect";
DA_T_errinfo *v_errinfo2 = NULL;
@@ -4052,21 +4052,21 @@
EXEC SQL BEGIN DECLARE SECTION;
long h_group_id;
- char h_dbname [ 255];
- char h_user_id [ 255];
- char h_con_name [ 255];
- char h_usrid_passwd[ 255];
+ char h_dbname [ 31];
+ char h_user_id [ 31];
+ char h_con_name [ 31];
+ char h_usrid_passwd[240];
short int h_ind_user_id;
EXEC SQL END DECLARE SECTION;
db_con = malloc(sizeof(DB_con));
- if(!db_con)
- return NULL;
+ if(!db_con)
+ return NULL;
+
+ lgda_set_connection_values(db_con, vp_connect_descr,
+ vp_userid, vp_passwd, vp_errinfo);
- lgda_set_connection_values(db_con, vp_connect_descr,
- vp_userid, vp_passwd, vp_errinfo);
-
/* ------------------ *
* Start of function
* ------------------ */
@@ -4082,17 +4082,17 @@
errln = 0;
EXEC SQL WHENEVER SQLERROR GOTO not_a_valid_db_user;
- strncpy(h_user_id, db_con->user_id, 255);
- strncpy(h_usrid_passwd, db_con->user_passwd, 255);
- strncpy(h_con_name, db_con->con_name, 255);
- strncpy(h_dbname, db_con->connection_target, 255);
+ strcpy(h_user_id, db_con->user_id);
+ strcpy(h_usrid_passwd, db_con->user_passwd);
+ strcpy(h_con_name, db_con->con_name);
+ strcpy(h_dbname, db_con->connection_target);
errln = 10;
EXEC SQL CONNECT TO :h_dbname AS :h_con_name USER :h_user_id USING :h_usrid_passwd;
if (!ECPGstatus(__LINE__, db_con->con_name))
{
- return(NULL);
+ return(NULL);
}
/* check if connected user is a valid GREAT-ER user and in case
@@ -4107,20 +4107,20 @@
errln = 30;
EXEC SQL SELECT :h_user_id
INTO :h_user_id INDICATOR :h_ind_user_id;
-
+
errln = 40;
EXEC SQL SELECT GROUP_ID
INTO :h_group_id
FROM USER_TAB
WHERE USER_ID = :h_user_id;
-
- strncpy(vg_db_user_info.user_id, h_user_id, 255);
- vg_db_user_info.group_id = h_group_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;
if(NULL){
not_a_valid_greater_user:
- /*
+ /*
* ERROR: no valid greater user
*/
vp_errinfo->err_type = DA_ERRTYP_INT;
@@ -4131,7 +4131,7 @@
gda_db_disconnect(db_con, v_errinfo2);
/* set return value */
- return(NULL);
+ return(NULL);
}
/* success fully connected to database */
@@ -4139,18 +4139,18 @@
if(NULL){
not_a_valid_db_user:
- /* set error information into return parameter */
- lgda_set_db_errinfo( v_module, vp_errinfo);
- db_con = NULL;
- return(db_con);
+ /* set error information into return parameter */
+ lgda_set_db_errinfo( v_module, vp_errinfo);
+ db_con = NULL;
+ return(db_con);
}
if(NULL){
sql_error:
- lgda_set_db_errinfo( v_module, vp_errinfo);
+ lgda_set_db_errinfo( v_module, vp_errinfo);
gda_db_disconnect(db_con, v_errinfo2);
- return(NULL);
- }
-}
+ return(NULL);
+ }
+}
/*********************************************************************
More information about the Greater-commits
mailing list