[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-28 19:57:52
Message-ID: 1159473472.113410.23716.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 589862 by staniek:

KexiDB
= use COUNT(*), not COUNT()
2.0: ported



 M  +9 -8      connection.cpp  
 M  +1 -1      utils.cpp  


--- branches/koffice/1.6/koffice/kexi/kexidb/connection.cpp #589861:589862
@@ -1252,9 +1252,10 @@
 	}
 	if (!s_where.isEmpty())
 		sql += QString::fromLatin1(" WHERE ") + s_where;
-//! \todo (js) add WHERE and other sql parts
+//! \todo (js) add other sql parts
 	//(use wasWhere here)
 
+	//KexiDBDbg << sql << endl;
 	return sql;
 }
 
@@ -2239,12 +2240,12 @@
 		m_sql = addLimitTo1 ? (*sql + " LIMIT 1") : *sql; // is this safe?
 	KexiDB::Cursor *cursor;
 	if (!(cursor = sql ? executeQuery( m_sql ) : executeQuery( *query ))) {
-		KexiDBDbg << "Connection::querySingleRecord(): !executeQuery()" << endl;
+		KexiDBWarn << "Connection::querySingleRecord(): !executeQuery() " << m_sql << \
endl;  return false;
 	}
 	if (!cursor->moveFirst() || cursor->eof()) {
 		const tristate result = cursor->error() ? false : cancelled;
-		KexiDBDbg << "Connection::querySingleRecord(): !cursor->moveFirst() || \
cursor->eof()" << endl; +		KexiDBWarn << "Connection::querySingleRecord(): \
!cursor->moveFirst() || cursor->eof()" << m_sql << endl;  setError(cursor);
 		deleteCursor(cursor);
 		return result;
@@ -2277,12 +2278,12 @@
 	KexiDB::Cursor *cursor;
 	m_sql = addLimitTo1 ? (sql + " LIMIT 1") : sql; // is this safe?;
 	if (!(cursor = executeQuery( m_sql ))) {
-		KexiDBDbg << "Connection::querySingleRecord(): !executeQuery()" << endl;
+		KexiDBWarn << "Connection::querySingleRecord(): !executeQuery() " << m_sql << \
endl;  return false;
 	}
 	if (!cursor->moveFirst() || cursor->eof()) {
 		const tristate result = cursor->error() ? false : cancelled;
-		KexiDBDbg << "Connection::querySingleRecord(): !cursor->moveFirst() || \
cursor->eof()" << endl; +		KexiDBWarn << "Connection::querySingleRecord(): \
!cursor->moveFirst() || cursor->eof() " << m_sql << endl;  deleteCursor(cursor);
 		return result;
 	}
@@ -2311,7 +2312,7 @@
 	clearError();
 	m_sql = sql;
 	if (!(cursor = executeQuery( m_sql ))) {
-		KexiDBDbg << "Connection::queryStringList(): !executeQuery()" << endl;
+		KexiDBWarn << "Connection::queryStringList(): !executeQuery() " << m_sql << endl;
 		return false;
 	}
 	if (!checkIfColumnExists(cursor, column)) {
@@ -2354,13 +2355,13 @@
 			m_sql = sql;
 	}
 	if (!(cursor = executeQuery( m_sql ))) {
-		KexiDBDbg << "Connection::querySingleRecord(): !executeQuery()" << endl;
+		KexiDBWarn << "Connection::querySingleRecord(): !executeQuery() " << m_sql << \
endl;  success = false;
 		return false;
 	}
 	if (!cursor->moveFirst() || cursor->eof()) {
 		success = !cursor->error();
-		KexiDBDbg << "Connection::querySingleRecord(): !cursor->moveFirst() || \
cursor->eof()" << endl; +		KexiDBWarn << "Connection::querySingleRecord(): \
!cursor->moveFirst() || cursor->eof() " << m_sql << endl;  setError(cursor);
 		deleteCursor(cursor);
 		return false;
--- branches/koffice/1.6/koffice/kexi/kexidb/utils.cpp #589861:589862
@@ -489,7 +489,7 @@
 	}
 	int count = -1; //will be changed only on success of querySingleNumber()
 	tableSchema.connection()->querySingleNumber(
-		QString::fromLatin1("SELECT COUNT() FROM ") 
+		QString::fromLatin1("SELECT COUNT(*) FROM ") 
 		+ tableSchema.connection()->driver()->escapeIdentifier(tableSchema.name()), 
 		count
 	);


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

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