/***************************************************************************
copyright : (C) 1999 by Edwin Glaser
email : edwin@pannenleiter.de
version : $Id: dbrecordodbc3.h,v 1.1.1.1 2000/02/07 21:42:09 ege Exp $
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef DBRECORDODBC3_H
#define DBRECORDODBC3_H
#include "common.h"
#include "dbrecord.h"
#include "dbdatasource.h"
/**
*@author Edwin Glaser
*/
class DBRecordODBC3.html">DBRecordODBC3 : public DBRecord {
protected:
SQLHENV henv;
SQLHDBC hdbc;
SQLHSTMT hstmt;
SQLHSTMT hwstmt;
bool paramOk;
bool fieldOk;
QString query;
DBTableDescription *table;
bool dbReadOnly;
SQLSMALLINT numCols;
DBColumnDescription *colDesc;
DBField *orgRecord;
DBField *record;
DBField *backupRecord;
long currentCursor;
long backupCursor;
SQLSMALLINT numParams;
DBColumnDescription *paramDesc;
SQLSMALLINT maxParams;
DBField *param;
QString errorInfo;
DBRecordODBC3 **autoIncQuery;
int numAutoInc;
bool assertWriteHandle();
void assertTableDef();
void setError(char *info, long errorcode, SQLHSTMT stmt = 0);
bool initInfo(SQLHSTMT hstmt);
bool initParams(SQLHSTMT hstmt);
bool getCharAttr(SQLHSTMT hstmt, int col, int type, char *buffer);
bool getIntAttr(SQLHSTMT hstmt, int col, int type, int *res);
bool getLongAttr(SQLHSTMT hstmt, int col, int type, long *res);
virtual bool doUpdate(DBTableDescription *t, bool *done, bool force);
virtual bool doInsert(DBTableDescription *t, bool *done, bool force);
virtual bool doRemove(DBTableDescription *t);
virtual DBField *getField(int pos);
virtual DBField *getParam(int pos);
bool init(bool keepOpen = false);
/** Initializes the working area with valid fields.
*
* @param todo SetCopy fetches the values from the database.<br>
* SetZero init to 0 or "".<br>
* SetNull init null values<br>
* SetAutoNull init autoincrement columns for generating a new value
*/
virtual bool validate(int todo);
/** Initializes the working area with invalid values.
*
* @param work Initializes the storrage used by setValue().
* @param org Initializes the storrage used to cancel setValue().
*/
virtual void invalidate(bool work, bool org);
virtual bool prepareAutoIncrement(int col);
virtual bool processAutoIncrement(int col);
void deleteAutoIncQuery();
bool createAutoIncQuery(int col);
public:
DBRecordODBC3(SQLHENV env, SQLHDBC dbc);
virtual ~DBRecordODBC3();
virtual bool isReadOnly();
virtual const QString &getErrorInfo();
virtual void setQuery(const QString &str, bool removeTables = false);
virtual void addTable(const char *table, const char *primaries, const char *columns);
virtual bool open();
virtual void close();
virtual bool refresh();
virtual bool first(bool *invalid);
virtual bool prior(bool *invalid);
virtual bool next(bool *invalid);
virtual bool last(bool *invalid);
virtual bool moveBy(bool *invalid, long);
virtual bool moveTo(bool *invalid, long);
virtual long getCursor();
virtual bool isDirty();
virtual bool cancel();
virtual bool update(bool *done = 0, bool force = false);
virtual bool insert(bool *done = 0, bool force = false);
virtual bool append(int todo);
virtual bool remove();
virtual void backup();
virtual bool restore();
virtual int getNumCols();
virtual const char *getColumnName(int col);
virtual const char *getColumnQualifierName(int col);
virtual int getColumnType(int col);
virtual const char *getColumnTypeName(int col);
virtual long getColumnLength(int col);
virtual int getColumnPrecision(int col);
virtual int getColumnScale(int );
virtual long getColumnDisplaySize(int col);
virtual int getColumnNullable(int col);
virtual int getColumnUnsigned(int col);
virtual int getColumnMoney(int col);
virtual int getColumnUpdatable(int col);
virtual int getColumnAutoIncrement(int col);
virtual long getNumRows();
virtual bool setValue(const DBField *field, int column, bool markDirty = true);
virtual bool setParameter(const DBField *field, int column);
virtual const DBField *getValue(int pos);
virtual const DBField *getParameter(int pos);
static void getErrorInfo(char *info, long errorcode, SQLHENV henv, SQLHDBC hdbc, QString *error);
static bool connect(char *dsn, SQLHENV *henv, SQLHDBC *hdbc, QString *error);
};
#endif
Documentation generated by eg@wonko on Sam Feb 19 00:09:53 MET 2000