20#include "dbproperties.h"
25DatabaseProperties::DatabaseProperties( Connection *conn)
31DatabaseProperties::~DatabaseProperties()
37 TQString name(_name.stripWhiteSpace());
40 bool exists = m_conn->resultExists(
41 TQString::fromLatin1( "SELECT 1 FROM kexi__db WHERE db_property=%1")
42 .arg(m_conn->driver()->escapeString(name)), ok);
44 setError(m_conn, i18n( "Could not set value of database property \"%1\".").arg(name));
49 if (!m_conn->executeSQL(
50 TQString::fromLatin1( "UPDATE kexi__db SET db_value=%1 WHERE db_property=%2")
51 .arg(m_conn->driver()->escapeString( value.toString()))
52 .arg(m_conn->driver()->escapeString(name))))
54 setError(m_conn, i18n( "Could not set value of database property \"%1\".").arg(name));
60 if (!m_conn->executeSQL(
61 TQString::fromLatin1( "INSERT INTO kexi__db (db_property, db_value) VALUES (%1, %2)")
62 .arg(m_conn->driver()->escapeString(name))
63 .arg(m_conn->driver()->escapeString( value.toString()))))
65 setError(m_conn, i18n( "Could not set value of database property \"%1\".").arg(name));
73 TQString name(_name.stripWhiteSpace());
78 bool exists = m_conn->resultExists(
79 TQString::fromLatin1( "SELECT 1 FROM kexi__db WHERE db_property=%1")
80 .arg(m_conn->driver()->escapeString(name)), ok);
82 setError(m_conn, i18n( "Could not set caption for database property \"%1\".").arg(name));
87 if (!m_conn->executeSQL(
88 TQString::fromLatin1( "UPDATE kexi__db SET db_value=%1 WHERE db_property=%2")
89 .arg(m_conn->driver()->escapeString( caption))
90 .arg(m_conn->driver()->escapeString(name))))
92 setError(m_conn, i18n( "Could not set caption for database property \"%1\".").arg(name));
98 if (!m_conn->executeSQL(
99 TQString::fromLatin1( "INSERT INTO kexi__db (db_property, db_value) VALUES (%1, %2)")
100 .arg(m_conn->driver()->escapeString(name))
101 .arg(m_conn->driver()->escapeString( caption))))
103 setError(m_conn, i18n( "Could not set caption for database property \"%1\".").arg(name));
112 TQString name(_name.stripWhiteSpace());
113 if ( true!=m_conn->querySingleString(
114 TQString::fromLatin1( "SELECT db_value FROM kexi__db WHERE db_property=")
115 + m_conn->driver()->escapeString(name), result)) {
116 m_conn->setError(ERR_NO_DB_PROPERTY, i18n( "Could not read database property \"%1\".").arg(name));
125 TQString name(_name.stripWhiteSpace());
128 if ( true!=m_conn->querySingleString(
129 TQString::fromLatin1( "SELECT db_value FROM kexi__db WHERE db_property=")
130 + m_conn->driver()->escapeString(name), result)) {
131 setError(m_conn, i18n( "Could not read database property \"%1\".").arg(name));
140 if ( true!=m_conn->queryStringList(
141 TQString::fromLatin1( "SELECT db_value FROM kexi__db WHERE db_property NOT LIKE ")
142 + m_conn->driver()->escapeString(TQString::fromLatin1( " %%")), result, 0 )) {
144 setError(m_conn, i18n( "Could not read database properties."));
145 return TQStringList();
Provides database connection, allowing queries and data modification.
bool setValue(const TQString &name, const TQVariant &value)
TQVariant value(const TQString &name)
bool setCaption(const TQString &name, const TQString &caption)
TQString caption(const TQString &name)
virtual void setError(int code=ERR_OTHER, const TQString &msg=TQString())
High-level database connectivity library with database backend drivers.
|