of_SetUser


pfcmain.pbl   >   pfc_n_tr   >   of_SetUser   

Full name pfc_n_tr.of_SetUser
Access public
Extend of
Return value
Prototype public subroutine of_SetUser(string,string)

Name Datatype
No Data

Name Datatype
lnv_string n_cst_string
ls_connectstring string
ls_password string
ls_userid string

public subroutine of_SetUser (string as_userid, string as_password);//////////////////////////////////////////////////////////////////////////////
//	Public Function:  of_SetUser
//	Arguments:			as_userid:  	User ID
//							as_password:	User's password
//	Returns:			None
//	Description:	Sets the property values of the transaction object for user id and password specified.
//						Note:	Use this function for ODBC database connections.  For native connections,
//						use of_SetLogidAndPassword or of_SetUseridAndPassword, depending on the DBMS
//////////////////////////////////////////////////////////////////////////////
//	Rev. History	Version
//						5.0   Initial version
//						5.0.02   Changed default behavior of function to modify the ConnectString
//									UID and PWD parameters in the dbparm property of the trans object.
//									Prior to the change, the function set the UserID and DBPass properties.
//////////////////////////////////////////////////////////////////////////////
//	Copyright © 1996-1999 Sybase, Inc. and its subsidiaries.  All rights reserved.  Any distribution of the 
// PowerBuilder Foundation Classes (PFC) source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//////////////////////////////////////////////////////////////////////////////
string	ls_connectstring
string	ls_userid
string	ls_password
n_cst_string	lnv_string

// Get connect string value
ls_connectstring = lnv_string.of_GetKeyValue (this.dbparm, "connectstring", ",")

if len (ls_connectstring) <= 0 then
	// No connectstring defined
	if len (this.dbparm) > 0 then
		ls_connectstring = ","
	end if
	ls_connectstring = ls_connectstring + "ConnectString='UID=" + as_userid + ";PWD=" + as_password + "'"
	this.dbparm = this.dbparm + ls_connectstring
else
	// Temporarily remove single quotes from connectstring
	ls_connectstring = lnv_string.of_globalReplace (ls_connectstring, "'", "")

	// Set User ID
	ls_userid = lnv_string.of_getKeyValue (ls_connectstring, "UID", ";")
	if len (ls_userid) > 0 then
		lnv_string.of_setKeyValue (ls_connectstring, "UID", as_userid, ";")
	else
		ls_connectstring = ls_connectstring + ";UID=" + as_userid
	end if
	
	// Set password
	ls_password = lnv_string.of_getKeyValue (ls_connectstring, "PWD", ";")
	if len (ls_password) > 0 then
		lnv_string.of_setKeyValue (ls_connectstring, "PWD", as_password, ";")
	else
		ls_connectstring = ls_connectstring + ";PWD=" + as_password
	end if
	
	// Restore single quotes
	ls_connectstring = "'" + ls_connectstring + "'"
	lnv_string.of_SetKeyValue (this.dbparm, "ConnectString", ls_connectstring, ",")
end if
end subroutine

     
Name Owner
No Data

     
Name Owner
systemfunctions.len systemfunctions
pfc_n_cst_string.of_globalreplace pfc_n_cst_string
pfc_n_cst_string.of_getkeyvalue pfc_n_cst_string
pfc_n_cst_string.of_setkeyvalue pfc_n_cst_string

     
Full name
No Data

     
Name Scope
No Data