Библиотека QT для работы со схемой базы данных.  1.0.1
qdataschemadriver.h
1 /****************************************************************************
2 ** $Id: qdataschemadriver.h,v 1.13 2009/06/11 14:59:25 app Exp $
3 **
4 ** Header file of the QDataSchemaDriver
5 **
6 ** Created : 20031201
7 **
8 ** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved.
9 **
10 ** This file is part of the Library of the Ananas
11 ** automation accounting system.
12 **
13 ** This file may be distributed and/or modified under the terms of the
14 ** GNU General Public License version 2 as published by the Free Software
15 ** Foundation and appearing in the file LICENSE.GPL included in the
16 ** packaging of this file.
17 **
18 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
19 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 **
21 ** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
22 ** See http://www.leaderit.ru/gpl/ for GPL licensing information.
23 **
24 ** Contact org@leaderit.ru if any conditions of this licensing are
25 ** not clear to you.
26 **
27 **********************************************************************/
28 
29 #ifndef QDATASCHEMADRIVER_H
30 #define QDATASCHEMADRIVER_H
31 #include "qdataschemaglobal.h"
32 
33 class QDataSchemaDriver: public QObject
34 {
35 Q_OBJECT
36 
37 public:
39  virtual QString sqlDriverName();
40  virtual QString fieldtype( const QString &qdstype,
41  int width, int decimals = 0,
42  bool notnull = false, bool primarykey = false, bool serial = false );
43  virtual QString systemTables(){ return "";};
44  virtual QString fieldSQLToDS( QSqlFieldInfo *ftypedef );
45  virtual QString fieldName( QSqlFieldInfo *ftypedef );
46  virtual int fieldWidth( QSqlFieldInfo *ftypedef );
47  virtual int fieldDecimals( QSqlFieldInfo *ftypedef );
48  virtual QString defaultDatabaseName(){ return "";};
49  // SQL queries generate functions
50  virtual QString queryInitConnection( bool unicode );
51  virtual QString queryCreateDatabase( const QString &name );
52  virtual QString queryDropDatabase( const QString &name );
53  virtual QString queryCreateTable( const QString &tname, const QString &fields );
54  virtual QString queryDropTable( const QString &tname );
55  virtual QString queryCreateIndex( const QString &tname, const QString &iname, const QString &fields );
56  virtual QString queryDropIndex( const QString &tname, const QString &iname );
57  virtual QString queryAlterTable( const QString &tname,
58  const QString &fieldsnew, const QString &fieldsold,
59  const QString &fieldsadd,const QString &fieldsdrop,
60  const QString &fieldsmodifynew,const QString &fieldsmodifyold );
61 protected:
62  virtual QString queryAlterTableDropField( const QString &tname, const QString &field );
63  virtual QString queryAlterTableAddField( const QString &tname, const QString &field );
64  virtual QString queryAlterTableModifyField( const QString &tname, const QString &field, const QString &oldfield = "" );
65 };
66 
67 #endif
Класс для работы с сервером БД.
Definition: qdataschemadriver.h:33
virtual QString queryAlterTable(const QString &tname, const QString &fieldsnew, const QString &fieldsold, const QString &fieldsadd, const QString &fieldsdrop, const QString &fieldsmodifynew, const QString &fieldsmodifyold)
Формирует запрос на обновление структуры таблицы.
Definition: qdataschemadriver.cpp:360