1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/***************************************************************************
* kexidbparser.cpp
* This file is part of the KDE project
* copyright (C)2004-2005 by Sebastian Sauer ([email protected])
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
* You should have received a copy of the GNU Library General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
***************************************************************************/
#include "kexidbparser.h"
#include "kexidbschema.h"
#include "kexidbconnection.h"
#include <api/variant.h>
using namespace Kross::KexiDB;
KexiDBParser::KexiDBParser(KexiDBConnection* connection, ::KexiDB::Parser* parser)
: Kross::Api::Class<KexiDBParser>("KexiDBParser")
, m_connection(connection)
, m_parser(parser)
{
this->addFunction1< Kross::Api::Variant, Kross::Api::Variant >("parse", this, &KexiDBParser::parse);
this->addFunction0< void >("clear", this, &KexiDBParser::clear);
this->addFunction0< Kross::Api::Variant >("operation", this, &KexiDBParser::operation);
this->addFunction0< KexiDBTableSchema >("table", this, &KexiDBParser::table);
this->addFunction0< KexiDBQuerySchema >("query", this, &KexiDBParser::query);
this->addFunction0< KexiDBConnection >("connection", this, &KexiDBParser::connection);
this->addFunction0< Kross::Api::Variant >("statement", this, &KexiDBParser::statement);
this->addFunction0< Kross::Api::Variant >("errorType", this, &KexiDBParser::errorType);
this->addFunction0< Kross::Api::Variant >("errorMsg", this, &KexiDBParser::errorMsg);
this->addFunction0< Kross::Api::Variant >("errorAt", this, &KexiDBParser::errorAt);
}
KexiDBParser::~KexiDBParser()
{
}
const TQString KexiDBParser::getClassName() const
{
return "Kross::KexiDB::KexiDBParser";
}
bool KexiDBParser::parse(const TQString& sql) { return m_parser->parse(sql); }
void KexiDBParser::clear() { m_parser->clear(); }
const TQString KexiDBParser::operation() { return m_parser->operationString(); }
KexiDBTableSchema* KexiDBParser::table() {
::KexiDB::TableSchema* t = m_parser->table();
return t ? new KexiDBTableSchema(t) : 0;
}
KexiDBQuerySchema* KexiDBParser::query() {
::KexiDB::QuerySchema* q = m_parser->query();
return q ? new KexiDBQuerySchema(q) : 0;
}
KexiDBConnection* KexiDBParser::connection() { return m_connection; }
const TQString KexiDBParser::statement() { return m_parser->statement(); }
const TQString KexiDBParser::errorType() { return m_parser->error().type(); }
const TQString KexiDBParser::errorMsg() { return m_parser->error().error(); }
int KexiDBParser::errorAt() { return m_parser->error().at(); }
|