head	1.2;
access;
symbols;
locks; strict;
comment	@# @;


1.2
date	2000.01.25.23.53.41;	author momjian;	state dead;
branches;
next	1.1;

1.1
date	99.11.29.23.26.18;	author momjian;	state Exp;
branches;
next	;


desc
@@


1.2
log
@ as attache of this mail is patch (to the main tree) with to_char's
family functions. Contain:

  conversion from a datetype to formatted text:

	to_char( datetime, 	text)
	to_char( timestamp,	text)
	to_char( int4,		text)
	to_char( int8,		text)
	to_char( float4,	text)
	to_char( float8,	text)
	to_char( numeric,	text)

  vice versa:

	to_date		( text, text)
	to_datetime	( text, text)
	to_timestamp	( text, text)
	to_number	( text, text)	   (convert to numeric)


  PostgreSQL to_char is very compatible with Oracle's to_char(), but not
total exactly (now). Small differentions are in number formating. It will
fix in next to_char() version.


! If will this patch aplly to the main tree, must be delete the current
  to_char version in contrib (directory "dateformat" and note in contrib's
  README), this patch not erase it (sorry Bruce).



The patch patching files:

	doc/src/sgml/func.sgml
                     ^^^^^^^^
   Hmm, I'm not sure if my English... :( Check it anyone (volunteer)?

   Thomas, it is right? SGML is not my primary lang  and compile
   the current PG docs tree is very happy job (hard variables setting in
   docs/sgml/Makefile --> HSTYLE= /home/users/t/thomas/....  :-)

   What add any definition to global configure.in and set Makefiles in docs
   tree via ./configure?

	src/backend/utils/adt/Makefile
	src/backend/utils/adt/formatting.c
	src/include/catalog/pg_proc.h
	src/include/utils/formatting.h
Karel Zak <zakkr@@zf.jcu.cz>              http://home.zf.jcu.cz/~zakkr/
@
text
@#-------------------------------------------------------------------------
#
# Makefile --
#
#    Makefile for TO-FROM_CHAR module.
#
#-------------------------------------------------------------------------

PGDIR = ../..
SRCDIR = $(PGDIR)/src

include $(SRCDIR)/Makefile.global

INCLUDE_OPT =	-I ./ \
		-I $(SRCDIR)/ \
		-I $(SRCDIR)/include \
		-I $(SRCDIR)/port/$(PORTNAME)

CFLAGS += $(INCLUDE_OPT) $(CFLAGS_SL)

MODNAME =	to-from_char

SQLDEFS =	$(MODNAME).sql

MODULE =	$(MODNAME)$(DLSUFFIX)

MODDIR =	$(LIBDIR)/modules

SQLDIR =	$(LIBDIR)/sql

all:		module sql

module:		$(MODULE)

sql:		$(SQLDEFS)

install:	$(MODULE) $(SQLDEFS) $(MODDIR) $(SQLDIR)
		cp -p $(MODULE) $(MODDIR)/
		strip $(MODDIR)/$(MODULE)
		cp -p $(SQLDEFS) $(SQLDIR)/

install-doc:	
		if [ -d "$(DOCDIR)" ]; then \
		    cp -p *.doc $(DOCDIR); \
		else \
		    cp -p *.doc $(SQLDIR); \
		fi

$(MODDIR):
		mkdir -p $@@

$(SQLDIR):
		mkdir -p $@@

%.sql: %.sql.in
		sed "s|MODULE_PATHNAME|$(MODDIR)/$(MODULE)|" < $< > $@@

.SUFFIXES: $(DLSUFFIX)

%$(DLSUFFIX): %.c
		$(CC) $(CFLAGS) -shared -o $@@ $<

depend dep:
		$(CC) -MM $(INCLUDE_OPT) *.c >depend

clean:
		rm -f *~ $(MODULE) $(MODNAME).sql

ifeq (depend,$(wildcard depend))
include depend
endif
@


1.1
log
@I finish devel. of Oracle compatible DateTime routines TO_CHAR(),
TO_DATE()
and PgSQL extension FROM_CHAR().

TO_CHAR() routine allow formating text output with a datetime values:

        SELECT TO_CHAR('now'::datetime, '"Now is: "HH24:MI:SS');
        to_char
        ----------------
        Now is: 21:04:10

FROM_CHAR() routine allow convert text to a datetime:

        SELECT FROM_CHAR('September 1999 10:20:30', 'FMMonth YYYY
HH:MI:SS');
        from_char
        -----------------------------
        Wed Sep 01 10:20:30 1999 CEST

TO_DATE() is equal with FROM_CHAR(), but output a Date only:

        SELECT TO_DATE('September 1999 10:20:30', 'FMMonth YYYY
HH:MI:SS');
        to_date
        ----------
        09-01-1999


In attache is compressed dir for the contrib. All is prepared, but I'am
not
sure if Makefile is good (probably yes).

Comments & suggestions ?


Thomas, thank you for your good advices.

                                                        Karel


------------------------------------------------------------------------------

Karel Zak <zakkr@@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/
@
text
@@

