[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/koffice/1.6/koffice/kexi/kexidb
From:       Jaroslaw Staniek <js () iidea ! pl>
Date:       2006-09-08 10:22:19
Message-ID: 1157710939.933125.26122.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 582117 by staniek:

KexiDB
= Added SimpleCommandLineApp class - an utility for writing small 
  command line programs and tests that support database connections
  out of the box and provide required arguments.
= debug areas fixed
2.0: merged



 M  +1 -1      Makefile.am  
 M  +2 -1      kexidb.pro  
 M  +4 -4      queryschema.cpp  
 M  +7 -6      queryschema.h  
 M  +4 -4      relationship.cpp  
 M  +3 -3      roweditbuffer.cpp  
 A             simplecommandlineapp.cpp   [License: LGPL (v2+)]
 A             simplecommandlineapp.h   [License: LGPL (v2+)]
 M  +17 -7     utils.cpp  
 M  +25 -6     utils.h  


--- branches/koffice/1.6/koffice/kexi/kexidb/Makefile.am #582116:582117
@@ -14,7 +14,7 @@
  indexschema.cpp queryschema.cpp schemadata.cpp global.cpp relationship.cpp \
  roweditbuffer.cpp msghandler.cpp \
  dbobjectnamevalidator.cpp preparedstatement.cpp \
- dbproperties.cpp admin.cpp alter.cpp lookupfieldschema.cpp
+ dbproperties.cpp admin.cpp alter.cpp lookupfieldschema.cpp simplecommandlineapp.cpp
 
 noinst_HEADERS = drivermanager_p.h utils_p.h
 
--- branches/koffice/1.6/koffice/kexi/kexidb/kexidb.pro #582116:582117
@@ -43,6 +43,7 @@
 keywords.cpp \
 preparedstatement.cpp \
 alter.cpp \
-lookupfieldschema.cpp
+lookupfieldschema.cpp \
+simplecommandlineapp.cpp
 
 #HEADERS =
--- branches/koffice/1.6/koffice/kexi/kexidb/queryschema.cpp #582116:582117
@@ -1297,19 +1297,19 @@
 /*
 	new field1, Field *field2
 	if (!field1 || !field2) {
-		kdWarning() << "QuerySchema::addRelationship(): !masterField || !detailsField" << \
endl; +		KexiDBWarn << "QuerySchema::addRelationship(): !masterField || \
!detailsField" << endl;  return;
 	}
 	if (field1->isQueryAsterisk() || field2->isQueryAsterisk()) {
-		kdWarning() << "QuerySchema::addRelationship(): relationship's fields cannot be \
asterisks" << endl; +		KexiDBWarn << "QuerySchema::addRelationship(): relationship's \
fields cannot be asterisks" << endl;  return;
 	}
 	if (!hasField(field1) && !hasField(field2)) {
-		kdWarning() << "QuerySchema::addRelationship(): fields do not belong to this \
query" << endl; +		KexiDBWarn << "QuerySchema::addRelationship(): fields do not \
belong to this query" << endl;  return;
 	}
 	if (field1->table() == field2->table()) {
-		kdWarning() << "QuerySchema::addRelationship(): fields cannot belong to the same \
table" << endl; +		KexiDBWarn << "QuerySchema::addRelationship(): fields cannot \
belong to the same table" << endl;  return;
 	}
 //@todo: check more things: -types
--- branches/koffice/1.6/koffice/kexi/kexidb/queryschema.h #582116:582117
@@ -400,22 +400,23 @@
 		 Note however, that the same field can be returned more than once if it has \
attached   a different alias.
 		 For example, let t be TABLE( a, b ) and let query be defined 
-		 by "SELECT *, a AS alfa FROM t" statement. Either fieldsExpanded(true) and \
                fieldsExpanded(false)
-		 will return [ a, b, a (alfa) ] list.
+		 by "SELECT *, a AS alfa FROM t" statement. Both fieldsExpanded(Default) 
+		 and fieldsExpanded(Unique) will return [ a, b, a (alfa) ] list.
 		 On the other hand, for query defined by "SELECT *, a FROM t" statement,
-		 fieldsExpanded(true) will return [ a, b ] list 
-		 and fieldsExpanded(false) will return [ a, b, a ] list.
+		 fieldsExpanded(Default) will return [ a, b, a ] list while
+		 fieldsExpanded(Unique) will return [ a, b ] list.
 
 		 If \a options is WithInternalFields or WithInternalFieldsAndRowID, 
 		 additional internal fields are also appended to the vector.
-		 If \a options is WithRowIDAndInternalFields, 
+
+		 If \a options is WithInternalFieldsAndRowID, 
 		 one fake BigInteger column is appended to make space for ROWID column used 
 		 by KexiDB::Cursor implementations. For example, let persons be TABLE( surname, \
city_id ),   let city_number reference cities.is in TABLE cities( id, name ) and let \
query q be defined   by "SELECT * FROM t" statement. If we want to display persons' \
city names instead of city_id's.  To do this, cities.name has to be retrieved as \
well, so the following statement should be used:  "SELECT * FROM persons, cities.name \
                LEFT OUTER JOIN cities ON persons.city_id=cities.id".
-		 Thus, calling fieldsExpanded(false, true, true) will return 4 elements instead of \
2: +		 Thus, calling fieldsExpanded(WithInternalFieldsAndRowID) will return 4 \
elements instead of 2:  persons.surname, persons.city_id, cities.name, {ROWID}. The \
{ROWID} item is the placeholder   used for fetching ROWID by KexiDB cursors.
 
--- branches/koffice/1.6/koffice/kexi/kexidb/relationship.cpp #582116:582117
@@ -68,20 +68,20 @@
 void Relationship::createIndices( QuerySchema *query, Field *field1, Field *field2 )
 {
 	if (!field1 || !field2 || !query) {
-		kdWarning() << "Relationship::addRelationship(): !masterField || !detailsField || \
!query" << endl; +		KexiDBWarn << "Relationship::addRelationship(): !masterField || \
!detailsField || !query" << endl;  return;
 	}
 	if (field1->isQueryAsterisk() || field2->isQueryAsterisk()) {
-		kdWarning() << "Relationship::addRelationship(): relationship's fields cannot be \
asterisks" << endl; +		KexiDBWarn << "Relationship::addRelationship(): relationship's \
fields cannot be asterisks" << endl;  return;
 	}
 	if (field1->table() == field2->table()) {
-		kdWarning() << "Relationship::addRelationship(): fields cannot belong to the same \
table" << endl; +		KexiDBWarn << "Relationship::addRelationship(): fields cannot \
belong to the same table" << endl;  return;
 	}
 //	if (!query->hasField(field1) && !query->hasField(field2)) {
 	if (!query->contains(field1->table()) || !query->contains(field2->table())) {
-		kdWarning() << "Relationship::addRelationship(): fields do not belong to this \
query" << endl; +		KexiDBWarn << "Relationship::addRelationship(): fields do not \
belong to this query" << endl;  return;
 	}
 //@todo: check more things: -types
--- branches/koffice/1.6/koffice/kexi/kexidb/roweditbuffer.cpp #582116:582117
@@ -114,15 +114,15 @@
 	if (isDBAware()) {
 		KexiDBDbg << "RowEditBuffer type=DB-AWARE, " << m_dbBuffer->count() <<" items"<< \
endl;  for (DBMap::ConstIterator it = m_dbBuffer->constBegin(); \
                it!=m_dbBuffer->constEnd(); ++it) {
-			kdDebug() << "* field name=" <<it.key()->field->name()<<" val="
+			KexiDBDbg << "* field name=" <<it.key()->field->name()<<" val="
 				<< (it.data().isNull() ? QString("<NULL>") : it.data().toString()) 
 				<< (hasDefaultValueAt(*it.key()) ? " DEFAULT" : "") <<endl;
 		}
 		return;
 	}
-	kdDebug() << "RowEditBuffer type=SIMPLE, " << m_simpleBuffer->count() <<" items"<< \
endl; +	KexiDBDbg << "RowEditBuffer type=SIMPLE, " << m_simpleBuffer->count() <<" \
items"<< endl;  for (SimpleMap::ConstIterator it = m_simpleBuffer->constBegin(); \
                it!=m_simpleBuffer->constEnd(); ++it) {
-		kdDebug() << "* field name=" <<it.key()<<" val="
+		KexiDBDbg << "* field name=" <<it.key()<<" val="
 			<< (it.data().isNull() ? QString("<NULL>") : it.data().toString()) <<endl;
 	}
 }
--- branches/koffice/1.6/koffice/kexi/kexidb/utils.cpp #582116:582117
@@ -187,16 +187,26 @@
 
 //-----------------------------------------
 
+TableOrQuerySchema::TableOrQuerySchema(Connection *conn, const QCString& name)
+ : m_name(name)
+{
+	m_table = conn->tableSchema(QString(name));
+	m_query = m_table ? 0 : conn->querySchema(QString(name));
+	if (!m_table && !m_query)
+		KexiDBWarn << "TableOrQuery(FieldList &tableOrQuery) : "
+			" tableOrQuery is nether table nor query!" << endl;
+}
+
 TableOrQuerySchema::TableOrQuerySchema(Connection *conn, const QCString& name, bool \
table)  : m_name(name)
  , m_table(table ? conn->tableSchema(QString(name)) : 0)
  , m_query(table ? 0 : conn->querySchema(QString(name)))
 {
 	if (table && !m_table)
-		kdWarning() << "TableOrQuery(Connection *conn, const QCString& name, bool table) : \
" +		KexiDBWarn << "TableOrQuery(Connection *conn, const QCString& name, bool table) \
: "  "no table specified!" << endl;
 	if (!table && !m_query)
-		kdWarning() << "TableOrQuery(Connection *conn, const QCString& name, bool table) : \
" +		KexiDBWarn << "TableOrQuery(Connection *conn, const QCString& name, bool table) \
: "  "no query specified!" << endl;
 }
 
@@ -205,7 +215,7 @@
  , m_query(dynamic_cast<QuerySchema*>(&tableOrQuery))
 {
 	if (!m_table && !m_query)
-		kdWarning() << "TableOrQuery(FieldList &tableOrQuery) : "
+		KexiDBWarn << "TableOrQuery(FieldList &tableOrQuery) : "
 			" tableOrQuery is nether table nor query!" << endl;
 }
 
@@ -214,7 +224,7 @@
 	m_table = conn->tableSchema(id);
 	m_query = m_table ? 0 : conn->querySchema(id);
 	if (!m_table && !m_query)
-		kdWarning() << "TableOrQuery(Connection *conn, int id) : no table or query found \
for id=="  +		KexiDBWarn << "TableOrQuery(Connection *conn, int id) : no table or \
query found for id=="   << id << "!" << endl;
 }
 
@@ -223,7 +233,7 @@
  , m_query(0)
 {
 	if (!m_table)
-		kdWarning() << "TableOrQuery(TableSchema* table) : no table specified!" << endl;
+		KexiDBWarn << "TableOrQuery(TableSchema* table) : no table specified!" << endl;
 }
 
 TableOrQuerySchema::TableOrQuerySchema(QuerySchema* query)
@@ -231,7 +241,7 @@
  , m_query(query)
 {
 	if (!m_query)
-		kdWarning() << "TableOrQuery(QuerySchema* query) : no query specified!" << endl;
+		KexiDBWarn << "TableOrQuery(QuerySchema* query) : no query specified!" << endl;
 }
 
 const QueryColumnInfo::Vector TableOrQuerySchema::columns(bool unique)
@@ -242,7 +252,7 @@
 	if (m_query)
 		return m_query->fieldsExpanded(unique ? QuerySchema::Unique : \
QuerySchema::Default);  
-	kdWarning() << "TableOrQuerySchema::column() : no query or table specified!" << \
endl; +	KexiDBWarn << "TableOrQuerySchema::column() : no query or table specified!" \
<< endl;  return QueryColumnInfo::Vector();
 }
 
--- branches/koffice/1.6/koffice/kexi/kexidb/utils.h #582116:582117
@@ -140,19 +140,38 @@
 	/*! Variant class providing a pointer to table or query. */
 	class KEXI_DB_EXPORT TableOrQuerySchema {
 		public:
-			//! Creates a new TableOrQuerySchema variant object, retrieving table or query \
                schema
-			//! using \a conn connection and \a name.
+			/*! Creates a new TableOrQuerySchema variant object, retrieving table or query \
schema +			 using \a conn connection and \a name. If both table and query exists for \
\a name, +			 table has priority over query. 
+			 You should check whether a query or table has been found by testing 
+			 (query() || table()) expression. */
+			TableOrQuerySchema(Connection *conn, const QCString& name);
+
+			/*! Creates a new TableOrQuerySchema variant object, retrieving table or query \
schema +			 using \a conn connection and \a name. If \a table is true, \a name is \
assumed  +			 to be a table name, otherwise \a name is assumed to be a query name. 
+			 You should check whether a query or table has been found by testing 
+			 (query() || table()) expression. */
 			TableOrQuerySchema(Connection *conn, const QCString& name, bool table);
 
-			//! Creates a new TableOrQuerySchema variant object. \a tableOrQuery must be of 
-			//! class TableSchema or QuerySchema.
+			/*! Creates a new TableOrQuerySchema variant object. \a tableOrQuery must be of 
+			 class TableSchema or QuerySchema.
+			 You should check whether a query or table has been found by testing 
+			 (query() || table()) expression. */
 			TableOrQuerySchema(FieldList &tableOrQuery);
 			
-			//! Creates a new TableOrQuerySchema variant object, retrieving table or query \
                schema
-			//! using \a conn connection and \a id.
+			/*! Creates a new TableOrQuerySchema variant object, retrieving table or query \
schema +			 using \a conn connection and \a id.
+			 You should check whether a query or table has been found by testing 
+			 (query() || table()) expression. */
 			TableOrQuerySchema(Connection *conn, int id);
 
+			/*! Creates a new TableOrQuerySchema variant object, keeping a pointer so \a \
table  +			 object. */
 			TableOrQuerySchema(TableSchema* table);
+
+			/*! Creates a new TableOrQuerySchema variant object, keeping a pointer so \a \
query  +			 object. */
 			TableOrQuerySchema(QuerySchema* query);
 
 			//! \return a pointer to the query if it's provided


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic