Re: [Patch] Multiline paste bug in EditGrid
От | Dave Page |
---|---|
Тема | Re: [Patch] Multiline paste bug in EditGrid |
Дата | |
Msg-id | CA+OCxoyA=OOoa9jEmHvJzQEGgxhz6GM5ztHxN=4Hi1jDe3=3jA@mail.gmail.com обсуждение исходный текст |
Ответ на | [Patch] Multiline paste bug in EditGrid (Robins <robins@pobox.com>) |
Список | pgadmin-hackers |
Thanks - applied with a minor tweak to make it work on Windows too. On Thu, Sep 8, 2011 at 2:04 AM, Robins <robins@pobox.com> wrote: > Hi, > > This is a small patch for a small bug I found while working in EditGrid. > I've outlined the bug below and given the patch alongside. > I intend to work on a few more minor bugs / small enhancements, that I've > noted down over time. Do let me know in case you believe that these patches > come in another way / presented differently etc.. > --- > Robins Tharakan > Issue: When we paste the following onto the first cell of the last row (the > empty row) in EditGrid, the last column is incorrectly evaluated. The value > accepted goes beyond the '\n' and is an odd mix of values with a '\n' > sandwiched in between. It generally is the last column of the first row as > well as the first value of the next row, with a '\n' sandwiched in between. > (If the first cell of the next row is quoted, the beginning quote is > included in this value as well). I believe that until we have a system in > place to accept multi-line paste, ideally we should omit the remaining lines > for now. > I've provided a few sample test cases below for better understanding. > Table: > CREATE TABLE tempdel > ( > project character varying(100) NOT NULL, > st date, > stop date, > CONSTRAINT pk PRIMARY KEY (project ) > ) > WITH ( > OIDS=FALSE > ); > Patch: > --- a/pgadmin/frm/frmEditGrid.cpp > +++ b/pgadmin/frm/frmEditGrid.cpp > @@ -3042,7 +3042,7 @@ bool sqlTable::Paste() > } > > if (inQuotes && text[pos] == quoteChar && > - text[pos + 1] == colSep) > + (text[pos + 1] == colSep || text[pos + 1] == '\n')) > { > data.Add(text.Mid(start, pos - start)); > start = (pos += 2); > > =========== > Test Case 1: > XML1a;"2010-12-24";"2011-02-24" > XML1b;"2010-12-24";"2011-02-24" > Last Cell Contents: > 2011-02-24" > XML1b;"2010-12-24 > =========== > Test Case 2: > XML2a;2010-12-24;"2011-02-24" > XML2b;2010-12-24;"2011-02-24" > Last Cell Contents: > 2011-02-24" > XML2b;2010-12-24;"2011-02-24" > =========== > Test Case 5: > XML5a;"2010-12-24";"2011-02-24" > XML5b;"2010-12-24";"2011-02-24" > Last Cell Contents: > 2011-02-24" > XML5b;"2010-12-24 > =========== > Test Case 6: > XML6a;"2010-12-24";"2011-02-24" > ;"2010-12-24";"2011-02-24" > Last Cell Contents: > 2011-02-24" > ;"2010-12-24 > -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgadmin-hackers по дате отправления: