3
* $Id: hl7sqlite.h 3535 2011-03-18 17:57:05Z carlos $
6
* Copyright 2008-10 MetaEmotion S.L. All rights reserved.
7
* http://ginkgo-cadx.com
9
* This file is licensed under LGPL v3 license.
10
* See License.txt for details
15
#include <wx/wxsqlite3/wxsqlite3.h>
16
#include <api/globals.h>
20
#define strcpy_s strcpy
21
#define strcat_s strcat
24
//#define _GINKGO_TRACE
26
/** Timeout values on busy or lock conditions **/
27
/** if you observe lock errors you might try to **/
28
/** increase the values. **/
29
#define SQLTM_COUNT 200 /** -> SQLTM_COUNT*SQLTM_TIME ms timeout **/
32
inline int AbrirConexionBBDDMensajes(wxSQLite3Database& dataBase,const std::string& DBFileName)
34
if(dataBase.IsOpen()) {
38
dataBase.Open(FROMPATH(DBFileName),wxEmptyString, WXSQLITE_OPEN_READWRITE|WXSQLITE_OPEN_CREATE);
40
dataBase.EnableForeignKeySupport(false);
45
inline int CreateMensajesHl7DB(wxSQLite3Database& dataBase,const std::string& DBFileName)
47
if (!AbrirConexionBBDDMensajes(dataBase, DBFileName)) {
50
/** Create Tables del Historial: **/
52
/** 1. Tabla de mensajes **/
53
wxString sentencia(wxT(""));
54
sentencia << wxT("CREATE TABLE MensajesHL7 (");
55
sentencia << wxT("IDMensaje INTEGER PRIMARY KEY,");
56
sentencia << wxT("FechaEnvio DATETIME,");
57
sentencia << wxT("Mensaje TEXT,");
58
sentencia << wxT("URLEnvio VARCHAR(1000),");
59
sentencia << wxT("Protocolo integer,");
60
sentencia << wxT("ProcesarACK CHAR,");
61
sentencia << wxT("MsgControlId VARCHAR(100) Default '',");
62
sentencia << wxT("MensajeError VARCHAR(500) Default NULL,");
63
sentencia << wxT("Enviado CHAR Default 'N');");
64
dataBase.ExecuteUpdate(sentencia);