~ubuntu-branches/ubuntu/wily/ginkgocadx/wily-proposed

« back to all changes in this revision

Viewing changes to src/cadxcore/sqlite/hl7sqlite.h

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Tille
  • Date: 2011-05-02 08:09:26 UTC
  • Revision ID: james.westby@ubuntu.com-20110502080926-bql5wep49c7hg91t
Tags: upstream-2.4.1.1
ImportĀ upstreamĀ versionĀ 2.4.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  
 
3
 *  $Id: hl7sqlite.h 3535 2011-03-18 17:57:05Z carlos $
 
4
 *  Ginkgo CADx Project
 
5
 *
 
6
 *  Copyright 2008-10 MetaEmotion S.L. All rights reserved.
 
7
 *  http://ginkgo-cadx.com
 
8
 *
 
9
 *  This file is licensed under LGPL v3 license.
 
10
 *  See License.txt for details
 
11
 *
 
12
 *
 
13
 */
 
14
#pragma once
 
15
#include <wx/wxsqlite3/wxsqlite3.h>
 
16
#include <api/globals.h>
 
17
#ifndef _WIN32
 
18
#include <unistd.h>
 
19
#define Sleep sleep
 
20
#define strcpy_s strcpy
 
21
#define strcat_s strcat
 
22
#endif
 
23
 
 
24
//#define _GINKGO_TRACE
 
25
 
 
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 **/
 
30
#define SQLTM_TIME        50
 
31
 
 
32
inline int AbrirConexionBBDDMensajes(wxSQLite3Database& dataBase,const std::string& DBFileName)
 
33
{
 
34
        if(dataBase.IsOpen()) {
 
35
                return (0);
 
36
        }
 
37
 
 
38
        dataBase.Open(FROMPATH(DBFileName),wxEmptyString, WXSQLITE_OPEN_READWRITE|WXSQLITE_OPEN_CREATE);
 
39
 
 
40
        dataBase.EnableForeignKeySupport(false);
 
41
 
 
42
         return 1;
 
43
}
 
44
 
 
45
inline int CreateMensajesHl7DB(wxSQLite3Database& dataBase,const std::string& DBFileName)
 
46
{
 
47
        if (!AbrirConexionBBDDMensajes(dataBase, DBFileName)) {
 
48
                return (0);
 
49
        }
 
50
    /** Create Tables del Historial: **/
 
51
 
 
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);
 
65
 
 
66
        return(1);
 
67
 
 
68
}
 
69
 
 
70
 
 
71
 
 
72