dbrecord.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Tomeu Borras Riera                              *
00003  *   tborras@conetxia.com                                                  *
00004  *   http://www.iglues.org                                                 *
00005  *                                                                         *
00006  *   This program is free software; you can redistribute it and/or modify  *
00007  *   it under the terms of the GNU General Public License as published by  *
00008  *   the Free Software Foundation; either version 2 of the License, or     *
00009  *   (at your option) any later version.                                   *
00010  *                                                                         *
00011  *   This program is distributed in the hope that it will be useful,       *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU General Public License for more details.                          *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU General Public License     *
00017  *   along with this program; if not, write to the                         *
00018  *   Free Software Foundation, Inc.,                                       *
00019  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00020  ***************************************************************************/
00021 
00022 #ifndef DBRECORD_H
00023 #define DBRECORD_H
00024 
00025 #include <QString>
00026 #include <QList>
00027 
00028 #include "postgresiface2.h"
00029 #include "funcaux.h"
00030 
00031 
00032 class DBCampo {
00033 public:
00034     enum dbtype {DBint = 1, DBvarchar = 2, DBdate = 3, DBnumeric = 4, DBboolean = 5};
00035     enum dbrestrict {DBNothing = 0, DBNotNull = 1, DBPrimaryKey = 2,
00036                      DBNoSave = 4, DBAuto = 8, DBDupPrimaryKey = 16, DBRequired = 32, DBNoLoad = 64};
00037 
00038 private:
00039     QString m_nomcampo;
00040     QString m_valorcampo;
00041     QString m_nompresentacion;
00042     int m_restrict;
00043     dbtype m_tipo;
00044     postgresiface2 *m_conexionbase;
00046     QString m_valorcampoorig;
00047 
00048 public:
00049     bool cambiado();
00050     void resetCambio();
00051     DBCampo(postgresiface2 *com, QString nom, dbtype typ, int res, QString nomp = "");
00052     virtual ~DBCampo();
00053     postgresiface2 *conexionbase();
00054     void setconexionbase(postgresiface2 *comp);
00055     dbtype tipo();
00056     virtual int set(QString val);
00057     int restrictcampo();
00058     QString nomcampo();
00059     QString nompresentacion();
00060     QString valorcampo();
00061     QString valorcampoprep(int &error);
00062 };
00063 
00064 
00065 class DBRecord {
00066 protected:
00067     QList<DBCampo *> m_lista;
00068     postgresiface2 *m_conexionbase;
00069     QString m_tablename;
00070     QString m_campoid;
00071     bool m_nuevoCampo;
00072 
00073 public:
00074     DBRecord(postgresiface2 *);
00075     virtual ~DBRecord();
00076     void setconexionbase(postgresiface2 *comp);
00077     postgresiface2 *conexionbase();
00078     int DBload(cursor2 *);
00079     virtual int DBsave(QString &id);
00080     virtual int setDBvalue(QString, QString);
00081     QString DBvalue(QString);
00082     bool exists(QString);
00083     QString DBvalueprep(QString);
00084     void setDBTableName(QString nom);
00085     void setNuevo(bool n);
00086     QString tableName();
00087     QString campoId();
00088     void setDBCampoId(QString nom);
00089     int addDBCampo(QString, DBCampo::dbtype, int, QString);
00090     void DBclear();
00091     QList<DBCampo *> *lista();
00092     virtual int borrar();
00093     virtual int guardar();
00094     virtual void vaciar();
00095     virtual void imprimir();
00096     virtual int cargar(QString);
00097 };
00098 
00099 #endif
00100 

Generated on Sat Dec 15 00:01:21 2007 for BulmaGes by  doxygen 1.5.1