예제 #1
0
void
FEapply_date_format(ADF_CB *cb, char *date_format)
{
    i4 date_fmt;
    CVlower(date_format);

    /* Use common function for date formats (kibro01) b119318 */
    date_fmt = adu_date_format(date_format);
    if (date_fmt == -1)
    {
    	IIUGerr(E_UG0020_BadDateFormat, 0, 1, (PTR)date_format);
	/* default is "us" */
    } else
    {
    	cb->adf_dfmt = date_fmt;
    }
}
예제 #2
0
/*
** Name: IILQasAdfcbChange
**
** Description:
**	Change the date_format on the fly.
**
**	Multiple sessions are stored as a linked list of session control 
**	blocks. However, there always exists a static default session block.
**	A static ADF control block is set up for the static default session
**	block while ADF control blocks for each session in the link list
**	are dynamically allocated. 
**	This routine only changes the current session date format and
**	the default session date format. 
** Inputs:
**	Date_format string.
**
** Outputs:
**	None.
**
** Returns:
**	STATUS
**	 	OK 	- ADF Control Block was succesfully allocated.
**		FAIL 	- Failed to allocate an ADF Control Block.
**
** Side Effects:
**	Changes the ADF control block date format for the current session (and
**      NOTE: this function is not called anywhere internally and probably
**      shouldn't be. Set date_format works properly from SQL tm now. This
**      function is left here in case any sites still use it.
**	for the default saved session).  You must issue a set date_format
**	statement to change the back-end date format. Otherwise all insert,
**	update date will be messed up.
**
** History:
**	05-jun-1997	(nanpr01)
**	    Written on request for karl schendel.
**	16-jun-1997 (nanpr01)
**	    Take out the dmy, mdy and ymd support since they are not supported
**	    in set date_format command.
**	24-Jun-1999 (shero03)
**	    Support ISO4 date.
**	18-Oct-2007 (kibro01) b119318
**	    Use a common function in adu to determine valid date formats
*/
STATUS
IILQasAdfcbChange(char *date_format)
{
    II_THR_CB	*thr_cb = IILQthThread();
    II_LBQ_CB	*IIlbqcb = thr_cb->ii_th_session;
    II_LBQ_CB	*def = &thr_cb->ii_th_defsess;

    if (date_format != NULL)
    {
	i4 date_value;
	CVlower(date_format);
	
	date_value = adu_date_format(date_format);
	if (date_value == -1)
	    return(E_DB_ERROR);

	IIlbqcb->ii_lq_adf->adf_dfmt = date_value;
	def->ii_lq_adf->adf_dfmt = date_value;
    }
    return(E_DB_OK);
}