Changeset View
Changeset View
Standalone View
Standalone View
kexi/plugins/queries/kexiqueryview.cpp
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Line(s) | 75 | { | |||
---|---|---|---|---|---|
83 | { | 83 | { | ||
84 | KexiUtils::WaitCursorRemover remover; | 84 | KexiUtils::WaitCursorRemover remover; | ||
85 | d->currentParams = KexiQueryParameters::getParameters(this, | 85 | d->currentParams = KexiQueryParameters::getParameters(this, | ||
86 | *conn->driver(), *query, ok); | 86 | *conn->driver(), *query, ok); | ||
87 | } | 87 | } | ||
88 | if (!ok) {//input cancelled | 88 | if (!ok) {//input cancelled | ||
89 | return cancelled; | 89 | return cancelled; | ||
90 | } | 90 | } | ||
91 | d->cursor = conn->executeQuery(*query, d->currentParams); | 91 | d->cursor = conn->prepareQuery(*query, d->currentParams); | ||
92 | if (!d->cursor) { | 92 | if (!d->cursor) { | ||
93 | window()->setStatus( | 93 | window()->setStatus( | ||
94 | conn, | 94 | conn, | ||
95 | i18n("Query executing failed.")); | 95 | i18n("Query executing failed.")); | ||
96 | //! @todo also provide server result and sql statement | 96 | //! @todo also provide server result and sql statement | ||
97 | return false; | 97 | return false; | ||
98 | } | 98 | } | ||
99 | setData(d->cursor); | 99 | ok = setData(d->cursor); | ||
100 | 100 | | |||
101 | //! @todo remove close() when dynamic cursors arrive | 101 | //! @todo remove close() when dynamic cursors arrive | ||
102 | d->cursor->close(); | 102 | if (!d->cursor->close()) { | ||
103 | 103 | ok = false; | |||
104 | if (oldCursor) | 104 | } | ||
105 | oldCursor->connection()->deleteCursor(oldCursor); | 105 | if (oldCursor) { | ||
106 | conn->deleteCursor(oldCursor); | ||||
107 | } | ||||
108 | if (!ok) { | ||||
109 | conn->deleteCursor(d->cursor); | ||||
110 | d->cursor = 0; | ||||
111 | return false; | ||||
112 | } | ||||
106 | 113 | | |||
107 | //! @todo maybe allow writing and inserting for single-table relations? | 114 | //! @todo maybe allow writing and inserting for single-table relations? | ||
108 | tableView()->setReadOnly(true); | 115 | tableView()->setReadOnly(true); | ||
109 | //! @todo maybe allow writing and inserting for single-table relations? | 116 | //! @todo maybe allow writing and inserting for single-table relations? | ||
110 | //set data model itself read-only too | 117 | //set data model itself read-only too | ||
111 | tableView()->data()->setReadOnly(true); | 118 | tableView()->data()->setReadOnly(true); | ||
112 | tableView()->setInsertingEnabled(false); | 119 | tableView()->setInsertingEnabled(false); | ||
113 | return true; | 120 | return true; | ||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |