| 1 | /***********************************************************************/ |
| 2 | /* JDBConn.h : header file for the JDBC connection classes. */ |
| 3 | /***********************************************************************/ |
| 4 | #include "javaconn.h" |
| 5 | |
| 6 | // JDBC connection to a data source |
| 7 | class TDBJDBC; |
| 8 | class JDBCCOL; |
| 9 | class JDBConn; |
| 10 | class TDBXJDC; |
| 11 | |
| 12 | /***********************************************************************/ |
| 13 | /* JDBConn class. */ |
| 14 | /***********************************************************************/ |
| 15 | class JDBConn : public JAVAConn { |
| 16 | friend class TDBJDBC; |
| 17 | friend class TDBXJDC; |
| 18 | //friend PQRYRES GetColumnInfo(PGLOBAL, char*&, char *, int, PVBLK&); |
| 19 | private: |
| 20 | JDBConn(); // Standard (unused) constructor |
| 21 | |
| 22 | public: |
| 23 | // Constructor |
| 24 | JDBConn(PGLOBAL g, PCSZ wrapper); |
| 25 | |
| 26 | virtual void AddJars(PSTRG jpop, char sep); |
| 27 | PQRYRES AllocateResult(PGLOBAL g, PTDB tdbp); |
| 28 | |
| 29 | // Attributes |
| 30 | public: |
| 31 | char *GetQuoteChar(void) { return m_IDQuoteChar; } |
| 32 | bool SetUUID(PGLOBAL g, PTDBJDBC tjp); |
| 33 | virtual int GetMaxValue(int infotype); |
| 34 | |
| 35 | public: |
| 36 | // Operations |
| 37 | virtual bool Connect(PJPARM sop); |
| 38 | virtual bool MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options, |
| 39 | PCSZ filter, bool pipe) {return true;} |
| 40 | virtual int GetResultSize(PCSZ sql, PCOL colp); |
| 41 | virtual int ExecuteCommand(PCSZ sql); |
| 42 | virtual int ExecuteQuery(PCSZ sql); |
| 43 | virtual int ExecuteUpdate(PCSZ sql); |
| 44 | virtual int Fetch(int pos = 0); |
| 45 | virtual void SetColumnValue(int rank, PSZ name, PVAL val); |
| 46 | |
| 47 | // Jdbc operations |
| 48 | bool PrepareSQL(PCSZ sql); |
| 49 | int ExecuteSQL(void); // Prepared statement |
| 50 | bool SetParam(JDBCCOL *colp); |
| 51 | int GetCatInfo(JCATPARM *cap); |
| 52 | bool GetDrivers(PQRYRES qrp); |
| 53 | PQRYRES GetMetaData(PGLOBAL g, PCSZ src); |
| 54 | int Rewind(PCSZ sql); |
| 55 | |
| 56 | // Implementation |
| 57 | public: |
| 58 | //virtual ~JDBConn(); |
| 59 | |
| 60 | protected: |
| 61 | // Members |
| 62 | jmethodID xqid; // The ExecuteQuery method ID |
| 63 | jmethodID xuid; // The ExecuteUpdate method ID |
| 64 | jmethodID xid; // The Execute method ID |
| 65 | jmethodID grs; // The GetResult method ID |
| 66 | jmethodID readid; // The ReadNext method ID |
| 67 | jmethodID fetchid; // The Fetch method ID |
| 68 | jmethodID typid; // The ColumnType method ID |
| 69 | jmethodID prepid; // The CreatePrepStmt method ID |
| 70 | jmethodID xpid; // The ExecutePrep method ID |
| 71 | jmethodID pcid; // The ClosePrepStmt method ID |
| 72 | jmethodID objfldid; // The ObjectField method ID |
| 73 | jmethodID chrfldid; // The StringField method ID |
| 74 | jmethodID intfldid; // The IntField method ID |
| 75 | jmethodID dblfldid; // The DoubleField method ID |
| 76 | jmethodID fltfldid; // The FloatField method ID |
| 77 | jmethodID datfldid; // The DateField method ID |
| 78 | jmethodID timfldid; // The TimeField method ID |
| 79 | jmethodID tspfldid; // The TimestampField method ID |
| 80 | jmethodID bigfldid; // The BigintField method ID |
| 81 | jmethodID uidfldid; // The UuidField method ID |
| 82 | char m_IDQuoteChar[2]; |
| 83 | PCSZ m_Pwd; |
| 84 | int m_Ncol; |
| 85 | int m_Aff; |
| 86 | int m_Fetch; |
| 87 | int m_RowsetSize; |
| 88 | jboolean m_Updatable; |
| 89 | jboolean m_Transact; |
| 90 | jboolean m_Scrollable; |
| 91 | bool m_Full; |
| 92 | }; // end of JDBConn class definition |
| 93 | |