Search Postgresql Archives

Re: [PATCHES] ISO week dates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Heikki Linnakangas a ecrit le 12/10/2006 12:43:
Guillaume Lelarge wrote:
I've tried to work on the first one, the ISO day field. My patch is attached and is against CVS HEAD. It only takes care of the code, nothing is done for documentation matter. It works with me :

I haven't been following this thread, but I just wanted to point out that we prefer context diffs.

Please resend the patch as a context diff, using "diff -c" or "cvs diff -c", so that it's easier to review.


Sorry, you're right. Here it is.


--
Guillaume.
Index: src/backend/utils/adt/formatting.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/formatting.c,v
retrieving revision 1.113
diff -c -r1.113 formatting.c
*** src/backend/utils/adt/formatting.c	4 Oct 2006 00:29:59 -0000	1.113
--- src/backend/utils/adt/formatting.c	12 Oct 2006 10:54:01 -0000
***************
*** 553,558 ****
--- 553,559 ----
  	DCH_HH24,
  	DCH_HH12,
  	DCH_HH,
+ 	DCH_ID,
  	DCH_IW,
  	DCH_IYYY,
  	DCH_IYY,
***************
*** 597,602 ****
--- 598,604 ----
  	DCH_hh24,
  	DCH_hh12,
  	DCH_hh,
+ 	DCH_id,
  	DCH_iw,
  	DCH_iyyy,
  	DCH_iyy,
***************
*** 695,701 ****
  	{"HH24", 4, dch_time, DCH_HH24, TRUE},		/* H */
  	{"HH12", 4, dch_time, DCH_HH12, TRUE},
  	{"HH", 2, dch_time, DCH_HH, TRUE},
! 	{"IW", 2, dch_date, DCH_IW, TRUE},	/* I */
  	{"IYYY", 4, dch_date, DCH_IYYY, TRUE},
  	{"IYY", 3, dch_date, DCH_IYY, TRUE},
  	{"IY", 2, dch_date, DCH_IY, TRUE},
--- 697,704 ----
  	{"HH24", 4, dch_time, DCH_HH24, TRUE},		/* H */
  	{"HH12", 4, dch_time, DCH_HH12, TRUE},
  	{"HH", 2, dch_time, DCH_HH, TRUE},
! 	{"ID", 2, dch_date, DCH_ID, TRUE},	/* I */
! 	{"IW", 2, dch_date, DCH_IW, TRUE},
  	{"IYYY", 4, dch_date, DCH_IYYY, TRUE},
  	{"IYY", 3, dch_date, DCH_IYY, TRUE},
  	{"IY", 2, dch_date, DCH_IY, TRUE},
***************
*** 739,745 ****
  	{"hh24", 4, dch_time, DCH_HH24, TRUE},		/* h */
  	{"hh12", 4, dch_time, DCH_HH12, TRUE},
  	{"hh", 2, dch_time, DCH_HH, TRUE},
! 	{"iw", 2, dch_date, DCH_IW, TRUE},	/* i */
  	{"iyyy", 4, dch_date, DCH_IYYY, TRUE},
  	{"iyy", 3, dch_date, DCH_IYY, TRUE},
  	{"iy", 2, dch_date, DCH_IY, TRUE},
--- 742,749 ----
  	{"hh24", 4, dch_time, DCH_HH24, TRUE},		/* h */
  	{"hh12", 4, dch_time, DCH_HH12, TRUE},
  	{"hh", 2, dch_time, DCH_HH, TRUE},
! 	{"id", 2, dch_date, DCH_ID, TRUE},	/* i */
! 	{"iw", 2, dch_date, DCH_IW, TRUE},
  	{"iyyy", 4, dch_date, DCH_IYYY, TRUE},
  	{"iyy", 3, dch_date, DCH_IYY, TRUE},
  	{"iy", 2, dch_date, DCH_IY, TRUE},
***************
*** 829,838 ****
  	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  	-1, -1, -1, -1, -1, DCH_A_D, DCH_B_C, DCH_CC, DCH_DAY, -1,
! 	DCH_FX, -1, DCH_HH24, DCH_IW, DCH_J, -1, -1, DCH_MI, -1, -1,
  	DCH_P_M, DCH_Q, DCH_RM, DCH_SSSS, DCH_TZ, DCH_US, -1, DCH_WW, -1, DCH_Y_YYY,
  	-1, -1, -1, -1, -1, -1, -1, DCH_a_d, DCH_b_c, DCH_cc,
! 	DCH_day, -1, DCH_fx, -1, DCH_hh24, DCH_iw, DCH_j, -1, -1, DCH_mi,
  	-1, -1, DCH_p_m, DCH_q, DCH_rm, DCH_ssss, DCH_tz, DCH_us, -1, DCH_ww,
  	-1, DCH_y_yyy, -1, -1, -1, -1
  
--- 833,842 ----
  	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  	-1, -1, -1, -1, -1, DCH_A_D, DCH_B_C, DCH_CC, DCH_DAY, -1,
! 	DCH_FX, -1, DCH_HH24, DCH_ID, DCH_J, -1, -1, DCH_MI, -1, -1,
  	DCH_P_M, DCH_Q, DCH_RM, DCH_SSSS, DCH_TZ, DCH_US, -1, DCH_WW, -1, DCH_Y_YYY,
  	-1, -1, -1, -1, -1, -1, -1, DCH_a_d, DCH_b_c, DCH_cc,
! 	DCH_day, -1, DCH_fx, -1, DCH_hh24, DCH_id, DCH_j, -1, -1, DCH_mi,
  	-1, -1, DCH_p_m, DCH_q, DCH_rm, DCH_ssss, DCH_tz, DCH_us, -1, DCH_ww,
  	-1, DCH_y_yyy, -1, -1, -1, -1
  
***************
*** 2367,2376 ****
  			}
  			break;
  		case DCH_D:
  			INVALID_FOR_INTERVAL;
  			if (is_to_char)
  			{
! 				sprintf(inout, "%d", tm->tm_wday + 1);
  				if (S_THth(suf))
  					str_numth(p_inout, inout, S_TH_TYPE(suf));
  				return strlen(p_inout);
--- 2371,2384 ----
  			}
  			break;
  		case DCH_D:
+ 		case DCH_ID:
  			INVALID_FOR_INTERVAL;
  			if (is_to_char)
  			{
! 				if (arg == DCH_D)
! 					sprintf(inout, "%d", tm->tm_wday + 1);
! 				else
! 					sprintf(inout, "%d", (tm->tm_wday == 0) ? 7 : tm->tm_wday);
  				if (S_THth(suf))
  					str_numth(p_inout, inout, S_TH_TYPE(suf));
  				return strlen(p_inout);
***************
*** 2378,2383 ****
--- 2386,2393 ----
  			else
  			{
  				sscanf(inout, "%1d", &tmfc->d);
+ 				if (arg == DCH_ID && tmfc->d == 7)
+ 					tmfc->d = 0;
  				return strspace_len(inout) + 1 + SKIP_THth(suf);
  			}
  			break;

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux