~ubuntu-branches/debian/sid/pgadmin3/sid

« back to all changes in this revision

Viewing changes to pgadmin/pgscript/statements/pgsWhileStmt.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Gerfried Fuchs
  • Date: 2009-07-30 12:27:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090730122716-fddbh42on721bbs2
Tags: 1.10.0-1
* New upstream release.
* Adjusted watch file to match release candidates.
* Updated to Standards-Version 3.8.2:
  - Moved to Section: database.
  - Add DEB_BUILD_OPTIONS support for parallel building.
  - Move from findstring to filter suggestion for DEB_BUILD_OPTIONS parsing.
* pgagent got split into its own separate source package by upstream.
* Exclude Docs.vcproj from installation.
* Move doc-base.enus from pgadmin3 to pgadmin3-data package, the files are
  in there too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//////////////////////////////////////////////////////////////////////////
 
2
//
 
3
// pgScript - PostgreSQL Tools
 
4
// RCS-ID:      $Id: pgsWhileStmt.cpp 7758 2009-03-26 20:49:59Z dpage $
 
5
// Copyright (C) 2002 - 2009, The pgAdmin Development Team
 
6
// This software is released under the BSD Licence
 
7
//
 
8
//////////////////////////////////////////////////////////////////////////
 
9
 
 
10
 
 
11
#include "pgAdmin3.h"
 
12
#include "pgscript/statements/pgsWhileStmt.h"
 
13
 
 
14
#include "pgscript/exceptions/pgsBreakException.h"
 
15
#include "pgscript/exceptions/pgsContinueException.h"
 
16
#include "pgscript/exceptions/pgsInterruptException.h"
 
17
#include "pgscript/utilities/pgsThread.h"
 
18
 
 
19
pgsWhileStmt::pgsWhileStmt(const pgsExpression * cond, const pgsStmt * stmt_list,
 
20
                pgsThread * app) :
 
21
        pgsStmt(app), m_cond(cond), m_stmt_list(stmt_list)
 
22
{
 
23
 
 
24
}
 
25
 
 
26
pgsWhileStmt::~pgsWhileStmt()
 
27
{
 
28
        pdelete(m_cond);
 
29
        pdelete(m_stmt_list);
 
30
}
 
31
 
 
32
void pgsWhileStmt::eval(pgsVarMap & vars) const
 
33
{
 
34
loop:
 
35
        if (m_cond->eval(vars)->pgs_is_true())
 
36
        {
 
37
                try
 
38
                {
 
39
                        m_stmt_list->eval(vars);
 
40
                }
 
41
                catch (const pgsBreakException &)
 
42
                {
 
43
                        goto end;
 
44
                }
 
45
                catch (const pgsContinueException &)
 
46
                {
 
47
                        
 
48
                }
 
49
                if (m_app != 0 && m_app->TestDestroy())
 
50
                        throw pgsInterruptException();
 
51
                
 
52
                goto loop;
 
53
        }
 
54
end: ;
 
55
}