Index: pgadmin/include/pgscript/parser.tab.hh =================================================================== --- pgadmin/include/pgscript/parser.tab.hh (revision 7688) +++ pgadmin/include/pgscript/parser.tab.hh (working copy) @@ -54,7 +54,7 @@ ////////////////////////////////////////////////////////////////////////// // // pgScript - PostgreSQL Tools -// RCS-ID: $Id: parser.tab.hh,v 1.8 2008/08/10 22:11:29 pgunittest Exp $ +// RCS-ID: $Id: pgsParser.yy,v 1.6 2008/08/10 22:11:29 pgunittest Exp $ // Copyright (C) 2002 - 2009, The pgAdmin Development Team // This software is released under the Artistic Licence // @@ -68,7 +68,7 @@ -/* Line 303 of lalr1.cc. */ +/* Line 35 of lalr1.cc. */ #line 73 "pgscript/parser.tab.hh" #include "location.hh" @@ -128,7 +128,7 @@ pgsStmt * stmt; pgsStmtList * stmt_list; } -/* Line 303 of lalr1.cc. */ +/* Line 35 of lalr1.cc. */ #line 133 "pgscript/parser.tab.hh" ; #else Index: pgadmin/frm/frmQuery.cpp =================================================================== --- pgadmin/frm/frmQuery.cpp (revision 7688) +++ pgadmin/frm/frmQuery.cpp (working copy) @@ -2198,7 +2198,6 @@ int selStart = sqlQuery->GetSelectionStart(), selEnd = sqlQuery->GetSelectionEnd(); if (selStart == selEnd) selStart = 0; - SetStatusText(wxString() << selStart, STATUSPOS_MSGS); int line = 0, maxLine = sqlQuery->GetLineCount(); while (line < maxLine && sqlQuery->GetLineEndPosition(line) < selStart) line++; Index: pgadmin/pgscript/lex.pgs.cc =================================================================== --- pgadmin/pgscript/lex.pgs.cc (revision 7688) +++ pgadmin/pgscript/lex.pgs.cc (working copy) @@ -687,7 +687,7 @@ ////////////////////////////////////////////////////////////////////////// // // pgScript - PostgreSQL Tools -// RCS-ID: $Id: lex.pgs.cc,v 1.8 2008/08/10 22:11:29 pgunittest Exp $ +// RCS-ID: $Id: pgsScanner.ll,v 1.5 2008/08/10 22:11:29 pgunittest Exp $ // Copyright (C) 2002 - 2009, The pgAdmin Development Team // This software is released under the Artistic Licence // @@ -1603,63 +1603,73 @@ #line 288 "pgscript/pgsScanner.ll" { query += yytext; yylloc->lines(yyleng); yylloc->step(); } YY_BREAK +case YY_STATE_EOF(SC_QUERY): +#line 289 "pgscript/pgsScanner.ll" +{ yylval->str = pnew wxString(query.c_str(), m_conv); + query.clear(); m_parent = 0; return query_token; } + YY_BREAK case 122: YY_RULE_SETUP -#line 289 "pgscript/pgsScanner.ll" +#line 291 "pgscript/pgsScanner.ll" { yylloc->columns(columns(*yytext)); query += yytext; } YY_BREAK case 123: YY_RULE_SETUP -#line 293 "pgscript/pgsScanner.ll" +#line 295 "pgscript/pgsScanner.ll" { query += yytext; if (std::string(yytext) == dollar) BEGIN(SC_QUERY); } YY_BREAK case 124: YY_RULE_SETUP -#line 295 "pgscript/pgsScanner.ll" +#line 297 "pgscript/pgsScanner.ll" { query += yytext; yylloc->step(); } YY_BREAK case 125: /* rule 125 can match eol */ YY_RULE_SETUP -#line 296 "pgscript/pgsScanner.ll" +#line 298 "pgscript/pgsScanner.ll" { query += yytext; yylloc->lines(yyleng); yylloc->step(); } YY_BREAK +case YY_STATE_EOF(SC_DOLLAR): +#line 299 "pgscript/pgsScanner.ll" +{ query += yytext; yylval->str = pnew wxString(query.c_str(), m_conv); + query.clear(); m_parent = 0; return query_token; } + YY_BREAK case 126: YY_RULE_SETUP -#line 297 "pgscript/pgsScanner.ll" +#line 301 "pgscript/pgsScanner.ll" { yylloc->columns(columns(*yytext)); query += yytext; } YY_BREAK case 127: YY_RULE_SETUP -#line 301 "pgscript/pgsScanner.ll" +#line 305 "pgscript/pgsScanner.ll" { BEGIN(comment_caller); } YY_BREAK case 128: YY_RULE_SETUP -#line 302 "pgscript/pgsScanner.ll" +#line 306 "pgscript/pgsScanner.ll" { yylloc->step(); } YY_BREAK case 129: /* rule 129 can match eol */ YY_RULE_SETUP -#line 303 "pgscript/pgsScanner.ll" +#line 307 "pgscript/pgsScanner.ll" { yylloc->lines(yyleng); yylloc->step(); } YY_BREAK case 130: YY_RULE_SETUP -#line 304 "pgscript/pgsScanner.ll" +#line 308 "pgscript/pgsScanner.ll" { yylloc->columns(columns(*yytext)); } YY_BREAK case 131: YY_RULE_SETUP -#line 308 "pgscript/pgsScanner.ll" +#line 312 "pgscript/pgsScanner.ll" { if (string_caller == SC_QUERY) query += yytext; @@ -1669,7 +1679,7 @@ YY_BREAK case 132: YY_RULE_SETUP -#line 314 "pgscript/pgsScanner.ll" +#line 318 "pgscript/pgsScanner.ll" { if (string_caller == SC_QUERY) query += yytext; @@ -1680,7 +1690,7 @@ YY_BREAK case 133: YY_RULE_SETUP -#line 321 "pgscript/pgsScanner.ll" +#line 325 "pgscript/pgsScanner.ll" { if (string_caller == SC_QUERY) { @@ -1698,7 +1708,7 @@ YY_BREAK case 134: YY_RULE_SETUP -#line 335 "pgscript/pgsScanner.ll" +#line 339 "pgscript/pgsScanner.ll" { if (string_caller == SC_QUERY) query += yytext; @@ -1710,7 +1720,7 @@ case 135: /* rule 135 can match eol */ YY_RULE_SETUP -#line 342 "pgscript/pgsScanner.ll" +#line 346 "pgscript/pgsScanner.ll" { if (string_caller == SC_QUERY) query += yytext; @@ -1719,9 +1729,26 @@ yylloc->lines(yyleng); yylloc->step(); } YY_BREAK +case YY_STATE_EOF(SC_STRING): +#line 353 "pgscript/pgsScanner.ll" +{ + if (string_caller == SC_QUERY) + { + query += yytext; yylval->str = pnew wxString(query.c_str(), m_conv); + query.clear(); m_parent = 0; return query_token; + } + else + { + yylval->str = pnew wxString(str.c_str(), m_conv); + str.clear(); + BEGIN(string_caller); + return token::PGS_VAL_STR; + } + } + YY_BREAK case 136: YY_RULE_SETUP -#line 349 "pgscript/pgsScanner.ll" +#line 367 "pgscript/pgsScanner.ll" { if (string_caller == SC_QUERY) query += yytext; @@ -1733,15 +1760,12 @@ case 137: YY_RULE_SETUP -#line 358 "pgscript/pgsScanner.ll" +#line 376 "pgscript/pgsScanner.ll" ECHO; YY_BREAK -#line 1737 "pgscript/lex.pgs.cc" +#line 1764 "pgscript/lex.pgs.cc" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(SC_COMMENT): -case YY_STATE_EOF(SC_QUERY): -case YY_STATE_EOF(SC_DOLLAR): -case YY_STATE_EOF(SC_STRING): yyterminate(); case YY_END_OF_BUFFER: @@ -2621,7 +2645,7 @@ #define YYTABLES_NAME "yytables" -#line 358 "pgscript/pgsScanner.ll" +#line 376 "pgscript/pgsScanner.ll" Index: pgadmin/pgscript/parser.tab.cc =================================================================== --- pgadmin/pgscript/parser.tab.cc (revision 7688) +++ pgadmin/pgscript/parser.tab.cc (working copy) @@ -534,7 +534,7 @@ // Initialize the initial location object yylloc.begin.filename = yylloc.end.filename; } - /* Line 555 of yacc.c. */ + /* Line 547 of yacc.c. */ #line 534 "pgscript/parser.tab.cc" /* Initialize the stacks. The initial state will be pushed in yynewstate, since the latter expects the semantical and the Index: pgadmin/pgscript/pgsScanner.ll =================================================================== --- pgadmin/pgscript/pgsScanner.ll (revision 7688) +++ pgadmin/pgscript/pgsScanner.ll (working copy) @@ -286,6 +286,8 @@ } \r { query += yytext; yylloc->step(); } \n { query += yytext; yylloc->lines(yyleng); yylloc->step(); } +<> { yylval->str = pnew wxString(query.c_str(), m_conv); + query.clear(); m_parent = 0; return query_token; } . { yylloc->columns(columns(*yytext)); query += yytext; } } @@ -294,6 +296,8 @@ if (std::string(yytext) == dollar) BEGIN(SC_QUERY); } \r { query += yytext; yylloc->step(); } \n { query += yytext; yylloc->lines(yyleng); yylloc->step(); } +<> { query += yytext; yylval->str = pnew wxString(query.c_str(), m_conv); + query.clear(); m_parent = 0; return query_token; } . { yylloc->columns(columns(*yytext)); query += yytext; } } @@ -346,6 +350,20 @@ str += yytext; yylloc->lines(yyleng); yylloc->step(); } +<> { + if (string_caller == SC_QUERY) + { + query += yytext; yylval->str = pnew wxString(query.c_str(), m_conv); + query.clear(); m_parent = 0; return query_token; + } + else + { + yylval->str = pnew wxString(str.c_str(), m_conv); + str.clear(); + BEGIN(string_caller); + return token::PGS_VAL_STR; + } + } . { if (string_caller == SC_QUERY) query += yytext; Index: pgadmin/pgscript/pgsApplication.cpp =================================================================== --- pgadmin/pgscript/pgsApplication.cpp (revision 7688) +++ pgadmin/pgscript/pgsApplication.cpp (working copy) @@ -142,6 +142,10 @@ void pgsApplication::Complete() { + // If last_error_line() == -1 then there was no error + // Else get the line number where the error occurred + m_last_error_line = m_thread->last_error_line(); + #if !defined(PGSCLI) if (m_caller != 0) { @@ -149,10 +153,6 @@ m_caller->AddPendingEvent(resultEvent); } #endif // PGSCLI - - // If last_error_line() == -1 then there was no error - // Else get the line number where the error occurred - m_last_error_line = m_thread->last_error_line(); wxLogScript(wxT("Execution completed")); }