1 /*************** TabRest H Declares Source Code File (.H) **************/
2 /*  Name: tabrest.h   Version 1.0                                      */
3 /*  (C) Copyright to the author Olivier BERTRAND          2019         */
4 /*  This file contains the common tabrest classes declares.            */
5 /***********************************************************************/
6 #pragma once
7 
8 #if defined(_WIN32)
9 static PCSZ slash = "\\";
10 #else // !_WIN32
11 static PCSZ slash = "/";
12 #define stricmp strcasecmp
13 #endif // !_WIN32
14 
15 typedef int(__stdcall* XGETREST) (char*, bool, PCSZ, PCSZ, PCSZ);
16 
17 /***********************************************************************/
18 /*  Functions used by REST.                                            */
19 /***********************************************************************/
20 XGETREST GetRestFunction(PGLOBAL g);
21 #if defined(REST_SOURCE)
22 extern "C" int restGetFile(char* m, bool xt, PCSZ http, PCSZ uri, PCSZ fn);
23 #endif   // REST_SOURCE
24 #if defined(MARIADB)
25 PQRYRES RESTColumns(PGLOBAL g, PTOS tp, char* tab, char* db, bool info);
26 #endif  // !MARIADB
27 
28 
29 /***********************************************************************/
30 /*  Restest table.                                                     */
31 /***********************************************************************/
32 class RESTDEF : public TABDEF {         /* Table description */
33 public:
34 	// Constructor
RESTDEF(void)35 	RESTDEF(void) { Tdp = NULL; Http = Uri = Fn = NULL; }
36 
37 	// Implementation
GetType(void)38 	virtual const char *GetType(void) { return "REST"; }
39 
40 	// Methods
41 	virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff);
42 	virtual PTDB GetTable(PGLOBAL g, MODE m);
43 
44 protected:
45 	// Members
46 	PRELDEF Tdp;
47 	PCSZ    Http;										/* Web connection HTTP               */
48 	PCSZ    Uri;							      /* Web connection URI                */
49 	PCSZ    Fn;                     /* The intermediate file name        */
50 }; // end of class RESTDEF
51