Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

utilbd.hpp

Go to the documentation of this file.
00001 
00002 //
00003 // Fichero            : utilbd.h
00004 //
00005 // Descripcion        : Utilidades para la BD
00006 //                      
00007 // 
00008 // Notas
00009 //    - 
00010 //
00011 //
00013 #ifndef UTILBD_H
00014 #define UTILBD_H
00015 
00016 #include "jic/exc/excepcion.hpp"
00017 #include <stdio.h>
00018 
00019 #define FMT_FECHA_CADENA_BD "'YYYY-MM-DD HH24:MI:SS'"  // @@ De momento como macro
00020 
00021 namespace BD
00022 {
00023 namespace UTIL
00024 {
00025         EXCEPCION(ExcBD);
00026         EXCEPCION_DE(ExcBD,ExcConvBD);
00027 
00028    //const char * FMT_FECHA_CADENA_BD = "'YYYY-MM-DD HH24:MI:SS'";
00029    
00030    static const int SIZE_FMT_FECHA_CADENA_BD = 23;   // Tamaņo de la cadena de formateo
00031    static const int SIZE_FECHA_CADENA_BD = 19;       // Tamaņo de una fecha
00032    static const char * strFmtDate = "%4d-%02d-%02d %02d:%02d:%02d";
00033    
00034                            
00035      //-- 
00036      //   Pasara un timestamp a una fecha en formato de bd (FMT_FECHA_CADENA_BD)
00037      //   (sin las comillas)     
00038    std::string ts_to_bdDate(const time_t timestamp);
00039                      
00040 
00041       //--  La fecha tiene que venir dada en el formato de FMT_FECHA_CADENA_BD      
00042       //    o bien ser el nombre de una variable con la que se va a hacer un bind
00043       //
00044       //    Notas: 
00045       //      - Hacer macros equivalentes
00046 
00047    std::string genDateSentenceFromDate(std::string strDate);
00048    std::string genDateSentenceFromVar(std::string strVar);
00049 
00050     
00051       //--  La fecha tiene que venir dada en el formato de FMT_FECHA_CADENA_BD      
00052    time_t bdDate_to_ts(std::string fecha);
00053                      
00054    
00055     //-- El siguiente metodo se usara para ayudar en la visualizacion de
00056     //   fechas. 
00057     //   Notas: - No muy optima    
00058         std::string bdDateColumn_to_char(std::string strName);
00059         
00060 
00061   time_t dateTokens_to_ts(int nYear,
00062                          int nMongh,
00063                          int nDay,
00064                          int nHour,
00065                          int nMin,
00066                          int nSec);
00067    
00068 
00069               
00070 } /* UTIL */   
00071 } /* BD */
00072 
00073 #endif /* BBDD_H */
00074 

Generated on Wed Mar 5 21:31:47 2003 for JIC by doxygen1.3-rc3