1/************** MongoFam H Declares Source Code File (.H) **************/
2/* Name: jmgfam.h Version 1.0 */
3/* */
4/* (C) Copyright to the author Olivier BERTRAND 2017 */
5/* */
6/* This file contains the JAVA MongoDB access method classes declares */
7/***********************************************************************/
8#pragma once
9
10/***********************************************************************/
11/* Include MongoDB library header files. */
12/***********************************************************************/
13#include "block.h"
14//#include "mongo.h"
15#include "jmgoconn.h"
16
17typedef class JMGFAM *PJMGFAM;
18typedef class MGODEF *PMGODEF;
19
20/***********************************************************************/
21/* This is the Java MongoDB Access Method class declaration. */
22/***********************************************************************/
23class DllExport JMGFAM : public DOSFAM {
24 friend void mongo_init(bool);
25public:
26 // Constructor
27 JMGFAM(PJDEF tdp);
28 JMGFAM(PJMGFAM txfp);
29
30 // Implementation
31 virtual AMT GetAmType(void) { return TYPE_AM_MGO; }
32 virtual bool GetUseTemp(void) { return false; }
33 virtual int GetPos(void);
34 virtual int GetNextPos(void);
35 virtual PTXF Duplicate(PGLOBAL g) { return (PTXF)new(g) JMGFAM(this); }
36 void SetLrecl(int lrecl) { Lrecl = lrecl; }
37
38 // Methods
39 virtual void Reset(void);
40 virtual int GetFileLength(PGLOBAL g);
41 virtual int Cardinality(PGLOBAL g);
42 virtual int MaxBlkSize(PGLOBAL g, int s);
43 virtual bool AllocateBuffer(PGLOBAL g) { return false; }
44 virtual int GetRowID(void);
45 virtual bool RecordPos(PGLOBAL g);
46 virtual bool SetPos(PGLOBAL g, int recpos);
47 virtual int SkipRecord(PGLOBAL g, bool header);
48 virtual bool OpenTableFile(PGLOBAL g);
49 virtual int ReadBuffer(PGLOBAL g);
50 virtual int WriteBuffer(PGLOBAL g);
51 virtual int DeleteRecords(PGLOBAL g, int irc);
52 virtual void CloseTableFile(PGLOBAL g, bool abort);
53 virtual void Rewind(void);
54
55protected:
56 virtual bool OpenTempFile(PGLOBAL g) { return false; }
57 virtual bool MoveIntermediateLines(PGLOBAL g, bool *b) { return false; }
58 virtual int RenameTempFile(PGLOBAL g) { return RC_OK; }
59 virtual int InitDelete(PGLOBAL g, int fpos, int spos);
60 bool Init(PGLOBAL g);
61//bool MakeCursor(PGLOBAL g);
62
63 // Members
64 JMgoConn *Jcp; // Points to a Mongo connection class
65 JDBCPARM Ops; // Additional parameters
66 PFBLOCK To_Fbt; // Pointer to temp file block
67 MODE Mode;
68 PCSZ Uristr;
69 PCSZ Db_name;
70 PCSZ Coll_name;
71 PCSZ Options;
72 PCSZ Filter;
73 PSZ Wrapname;
74 bool Done; // Init done
75 bool Pipe;
76 int Version;
77 int Curpos; // Cursor position of last fetch
78}; // end of class JMGFAM
79
80