Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/scripting/kexidb/kexidbdriver.cpp
Show All 16 Lines | |||||
17 | * Boston, MA 02110-1301, USA. | 17 | * Boston, MA 02110-1301, USA. | ||
18 | ***************************************************************************/ | 18 | ***************************************************************************/ | ||
19 | 19 | | |||
20 | #include "kexidbdriver.h" | 20 | #include "kexidbdriver.h" | ||
21 | #include "kexidbconnection.h" | 21 | #include "kexidbconnection.h" | ||
22 | #include "kexidbconnectiondata.h" | 22 | #include "kexidbconnectiondata.h" | ||
23 | 23 | | |||
24 | #include <KDbConnection> | 24 | #include <KDbConnection> | ||
25 | #include <KDbDriverMetaData> | ||||
25 | 26 | | |||
26 | using namespace Scripting; | 27 | using namespace Scripting; | ||
27 | 28 | | |||
28 | KexiDBDriver::KexiDBDriver(QObject* parent, KDbDriver* driver) | 29 | KexiDBDriver::KexiDBDriver(QObject* parent, KDbDriver* driver) | ||
29 | : QObject(parent) | 30 | : QObject(parent) | ||
30 | , m_driver(driver) | 31 | , m_driver(driver) | ||
31 | { | 32 | { | ||
32 | setObjectName("KexiDBDriver"); | 33 | setObjectName("KexiDBDriver"); | ||
33 | } | 34 | } | ||
34 | 35 | | |||
35 | KexiDBDriver::~KexiDBDriver() | 36 | KexiDBDriver::~KexiDBDriver() | ||
36 | { | 37 | { | ||
37 | } | 38 | } | ||
38 | 39 | | |||
39 | bool KexiDBDriver::isValid() | 40 | bool KexiDBDriver::isValid() | ||
40 | { | 41 | { | ||
41 | return m_driver->isValid(); | 42 | return !m_driver->result().isError(); | ||
42 | } | 43 | } | ||
43 | 44 | | |||
44 | QString KexiDBDriver::escapeString(const QString& s) | 45 | QString KexiDBDriver::escapeString(const QString& s) | ||
45 | { | 46 | { | ||
46 | return m_driver->escapeString(s); | 47 | return m_driver->escapeString(KDbEscapedString(s).toString()).toString(); | ||
47 | } | 48 | } | ||
48 | bool KexiDBDriver::isFileDriver() | 49 | bool KexiDBDriver::isFileDriver() | ||
49 | { | 50 | { | ||
50 | return m_driver->isFileDriver(); | 51 | return m_driver->metaData()->isFileBased(); | ||
51 | } | 52 | } | ||
52 | QString KexiDBDriver::fileDBDriverMimeType() | 53 | QStringList KexiDBDriver::fileDBDriverMimeTypes() | ||
53 | { | 54 | { | ||
54 | return m_driver->fileDBDriverMimeType(); | 55 | return m_driver->metaData()->mimeTypes(); | ||
staniek: m_driver->metaData()->mimeTypes()? | |||||
55 | } | 56 | } | ||
56 | bool KexiDBDriver::isSystemObjectName(const QString& name) | 57 | bool KexiDBDriver::isSystemObjectName(const QString& name) | ||
57 | { | 58 | { | ||
58 | return m_driver->isSystemObjectName(name); | 59 | return m_driver->isSystemObjectName(name); | ||
59 | } | 60 | } | ||
60 | bool KexiDBDriver::isSystemDatabaseName(const QString& name) | 61 | bool KexiDBDriver::isSystemDatabaseName(const QString& name) | ||
61 | { | 62 | { | ||
62 | return m_driver->isSystemDatabaseName(name); | 63 | return m_driver->isSystemDatabaseName(name); | ||
63 | } | 64 | } | ||
64 | bool KexiDBDriver::isSystemFieldName(const QString& name) | 65 | bool KexiDBDriver::isSystemFieldName(const QString& name) | ||
65 | { | 66 | { | ||
66 | return m_driver->isSystemFieldName(name); | 67 | return m_driver->isSystemFieldName(name); | ||
67 | } | 68 | } | ||
68 | QString KexiDBDriver::valueToSql(const QString& fieldtype, const QVariant& value) | 69 | QString KexiDBDriver::valueToSql(const QString& fieldtype, const QVariant& value) | ||
69 | { | 70 | { | ||
70 | return m_driver->valueToSql(fieldtype, value); | 71 | return m_driver->valueToSql(KDbField::typeForString(fieldtype), value).toString(); | ||
71 | } | 72 | } | ||
72 | 73 | | |||
73 | QObject* KexiDBDriver::createConnection(QObject* data) | 74 | QObject* KexiDBDriver::createConnection(QObject* data) | ||
74 | { | 75 | { | ||
75 | KexiDBConnectionData* d = dynamic_cast<KexiDBConnectionData*>(data); | 76 | KexiDBConnectionData* d = dynamic_cast<KexiDBConnectionData*>(data); | ||
76 | return d ? new KexiDBConnection(m_driver->createConnection(*d->data())) : 0; | 77 | return d ? new KexiDBConnection(m_driver->createConnection(*d->data())) : 0; | ||
77 | } | 78 | } | ||
78 | 79 | | |||
Show All 11 Lines |
m_driver->metaData()->mimeTypes()?