1
1
//////////////////////////////////////////////////////////////////////////
3
3
// pgScript - PostgreSQL Tools
5
// Copyright (C) 2002 - 2010, The pgAdmin Development Team
5
// Copyright (C) 2002 - 2011, The pgAdmin Development Team
6
6
// This software is released under the PostgreSQL Licence
8
8
//////////////////////////////////////////////////////////////////////////
23
23
class pgsThread : public wxThread
28
28
/** Symbol table (memory variables). */
31
31
/** In order to have only one thread at once. */
32
wxSemaphore & m_mutex;
34
34
/** Connection to the database. */
35
pgConn * m_connection;
37
37
/** Either the file to parse or the string. */
40
40
/** Where to write the output. */
41
pgsOutputStream & m_out;
41
pgsOutputStream &m_out;
43
43
/** The calling application. */
44
pgsApplication & m_app;
44
pgsApplication &m_app;
46
46
/** If set it is the encoding used in the file to parse. */
49
49
/** Location of the last error if there was one otherwise -1 */
50
50
int m_last_error_line;
54
54
/** Parses a file with the provided encoding. */
55
pgsThread(pgsVarMap & vars, wxSemaphore & mutex, pgConn * connection,
56
const wxString & file, pgsOutputStream & out,
57
pgsApplication & app, wxMBConv * conv);
55
pgsThread(pgsVarMap &vars, wxSemaphore &mutex, pgConn *connection,
56
const wxString &file, pgsOutputStream &out,
57
pgsApplication &app, wxMBConv *conv);
59
59
/** Parses a wxString. */
60
pgsThread(pgsVarMap & vars, wxSemaphore & mutex, pgConn * connection,
61
const wxString & string, pgsOutputStream & out, pgsApplication & app);
60
pgsThread(pgsVarMap &vars, wxSemaphore &mutex, pgConn *connection,
61
const wxString &string, pgsOutputStream &out, pgsApplication &app);
66
66
/** Thread main code. */
67
virtual void * Entry();
67
virtual void *Entry();
69
69
/** Retrieves the connection to the database. */
70
pgConn * connection();
72
72
/** Gets a lock on the output stream. */
75
75
/** Releases the lock on the output stream. */
76
76
void UnlockOutput();
78
78
/** Set the position (line) of the last error. */
79
79
void last_error_line(int line);
81
81
/** Get the position (line) of the last error. */
82
82
int last_error_line() const;
86
pgsThread(const pgsThread & that);
88
pgsThread & operator=(const pgsThread & that);
86
pgsThread(const pgsThread &that);
88
pgsThread &operator=(const pgsThread &that);
92
92
#endif /*PGSTHREAD_H_*/