OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
3.2 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../koffice/0002-koffice-2.3-kexi-fix-insert-required-value.patch
  5. # Copyright (C) 2011 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. diff --git a/kexi/widget/tableview/kexitableviewdata.cpp b/kexi/widget/tableview/kexitableviewdata.cpp
  17. index 845c0aa..9dc89d7 100644
  18. --- a/kexi/widget/tableview/kexitableviewdata.cpp
  19. +++ b/kexi/widget/tableview/kexitableviewdata.cpp
  20. @@ -565,12 +565,12 @@ bool KexiTableViewData::updateRowEditBufferRef(KexiDB::RecordData *record,
  21. //get a new value (if present in the buffer), or the old one, otherwise
  22. //(taken here for optimization)
  23. -#define GET_VALUE if (!val) { \
  24. - val = d->cursor \
  25. +#define GET_VALUE if (!pval) { \
  26. + pval = d->cursor \
  27. ? d->pRowEditBuffer->at( *(*it_f)->columnInfo(), (*it_r).isNull() /* useDefaultValueIfPossible */ ) \
  28. : d->pRowEditBuffer->at( *f ); \
  29. - if (!val) \
  30. - val = &(*it_r); /* get old value */ \
  31. + val = pval ? *pval : *it_r; /* get old value */ \
  32. + /*kDebug() << col << (*it_f)->columnInfo()->debugString() << "val:" << val;*/ \
  33. }
  34. //! @todo if there're multiple views for this data, we need multiple buffers!
  35. @@ -584,13 +584,14 @@ bool KexiTableViewData::saveRow(KexiDB::RecordData& record, bool insert, bool re
  36. KexiTableViewColumn::ListIterator it_f(m_columns.constBegin());
  37. KexiDB::RecordData::ConstIterator it_r = record.constBegin();
  38. int col = 0;
  39. - const QVariant *val = 0;
  40. + const QVariant *pval = 0;
  41. + QVariant val;
  42. for (;it_f != m_columns.constEnd() && it_r != record.constEnd();++it_f, ++it_r, col++) {
  43. KexiDB::Field *f = (*it_f)->field();
  44. if (f->isNotNull()) {
  45. GET_VALUE;
  46. //check it
  47. - if (val->isNull() && !f->isAutoIncrement()) {
  48. + if (val.isNull() && !f->isAutoIncrement()) {
  49. //NOT NULL violated
  50. d->result.msg = i18n("\"%1\" column requires a value to be entered.",
  51. f->captionOrName()) + "\n\n" + Kexi::msgYouCanImproveData();
  52. @@ -601,7 +602,7 @@ bool KexiTableViewData::saveRow(KexiDB::RecordData& record, bool insert, bool re
  53. }
  54. if (f->isNotEmpty()) {
  55. GET_VALUE;
  56. - if (!f->isAutoIncrement() && (val->isNull() || KexiDB::isEmptyValue(f, *val))) {
  57. + if (!f->isAutoIncrement() && (val.isNull() || KexiDB::isEmptyValue(f, val))) {
  58. //NOT EMPTY violated
  59. d->result.msg = i18n("\"%1\" column requires a value to be entered.",
  60. f->captionOrName()) + "\n\n" + Kexi::msgYouCanImproveData();