Dan's Summer of Code2015-08-23T23:04:30+00:00http://dan.ungureanu.meDan Ungureanudan@ungureanu.meLast week2015-08-23T00:00:00+00:00http://dan.ungureanu.me/gsoc-2015/2015/08/23/last-week<p>This was the last week of the Google Summer of Code program. The organizers of the program advised us to do documentation and wrap-up the project. I went over my proposal to check that all objectives were met and I have also been looking through and my code and tried spotting any errors. Most of the errors fixed were reported by Scrutinizer.</p>
<p>Another task I took care of was to submit my final evaluation and prepare the code samples I have to submit next week.</p>
<p>I would like to thank to the phpMyAdmin team and my mentor, Marc Delisle, for giving me the opportunity to participate in Google Summer of Code and spending their time with me. I believe this is one of the best work experiences I ever had and I am proud of the library I wrote, the way it turned out and how I integrated it in phpMyAdmin.</p>
<p>I hope that time will permit me to continue contributing to phpMyAdmin.</p>
<p>To see my work over the summer, you can check out <a href="https://github.com/udan11/sql-parser">my library repository</a> or the <a href="https://github.com/phpmyadmin/phpmyadmin/pulls?utf8=%E2%9C%93&q=author%3Audan11">pull requests</a> I submitted.</p>
Week 122015-08-16T00:00:00+00:00http://dan.ungureanu.me/gsoc-2015/2015/08/16/week-12<p>This week, most of my work was done on sql-parser. I fixed a couple of bugs, wrote tests for the new features introduced over the last weeks, updated documentation (wiki as well) and moved the tools for tests and contexts generation to the sql-parser repository.</p>
<p>Next week is the last week week of Google Summer of Code and I will focus on fixing bugs and miscellaneous improvements (documentation and refactoring mostly).</p>
<p>To see my progress, you can check out <a href="https://github.com/udan11/sql-parser">my library repository</a> or some of the <a href="https://github.com/phpmyadmin/phpmyadmin/pulls?utf8=%E2%9C%93&q=author%3Audan11">pull requests</a> I submitted this week.</p>
Week 112015-08-09T00:00:00+00:00http://dan.ungureanu.me/gsoc-2015/2015/08/09/week-11<p>This week I found and fixed a a couple of bugs and rewrote an important part of the import mechanism of phpMyAdmin.</p>
<p>One of the most challenging tasks of this week was probably implementing the new import mechanism. The fact that it has to process so much data made performance a top priority.</p>
<p>At first, I tried using the standard lexer to delimit statements, but I failed. For huge queries (that are also buffered) parsing the query over and over again to check if a statement finished was too slow. I decided to write a specialized parser (<code>BufferedQuery</code>) that tries to parse only the most important parts of the query (comments, strings and delimiters) in order to be able to split the statements and execute them separately. At this moment is performs well and also fixes bug <a href="https://github.com/phpmyadmin/phpmyadmin/issues/11339">#11339</a> which was reopened due to some edge case not being handled correctly.</p>
<p>For the next week, I planned on finishing the query builder and write tests.</p>
<p>To see my progress, you can check out <a href="https://github.com/udan11/sql-parser">my library repository</a> or some of the <a href="https://github.com/phpmyadmin/phpmyadmin/pulls?utf8=%E2%9C%93&q=author%3Audan11">pull requests</a> I submitted this week.</p>
Week 102015-08-02T00:00:00+00:00http://dan.ungureanu.me/gsoc-2015/2015/08/02/week-10<p>This week I found and fixed a a couple of bugs, wrote a new formatting component in the parsing library and rewrote a part of the import mechanism to use the library I wrote.</p>
<p>One of the most challenging tasks of this week was probably writing the formatting library. I tried a couple of designs and ended up rewriting this component for about five times. None of them worked as I expected and sometimes they relied on some cheap hacks to get the job done, thing I didn’t like at all. At this moment, the component relies on the tokens provided by the lexer and takes into account a couple of settings to format the code.</p>
<p>The other components of the library got some improvements as well, mostly bug fixes. I really hope that during next week I will get to write some tests and finish the query builder.</p>
<p>To see my progress, you can check out <a href="https://github.com/udan11/sql-parser">my library repository</a> or some of the <a href="https://github.com/phpmyadmin/phpmyadmin/pulls?utf8=%E2%9C%93&q=author%3Audan11">pull requests</a> I submitted this week.</p>
Week 92015-07-26T00:00:00+00:00http://dan.ungureanu.me/gsoc-2015/2015/07/26/week-9<p>During the past week I tried to improve the overall quality of the code base which consisted of writing a couple of tests, fixing over 200 of Scrutinizer’s issues and also fixed some old bugs regarding the parser. The library got some updates as well, including more rules to check for errors in queries, support for transactions and improved support for UNIONs.</p>
<p>I wish I wrote more tests during this week, but for the next one I will try to focus more on that and increase the overall code coverage. </p>
<p>To see my progress, you can check out <a href="https://github.com/udan11/sql-parser">my library repository</a>, some of the pull requests <a href="https://github.com/phpmyadmin/phpmyadmin/pull/11319">#11319</a>, <a href="https://github.com/phpmyadmin/phpmyadmin/pull/1816">#1816</a>, <a href="https://github.com/phpmyadmin/phpmyadmin/pull/1811">#1811</a>, <a href="https://github.com/phpmyadmin/phpmyadmin/pull/1807">#1807</a> or the bugs I fixed <a href="https://github.com/phpmyadmin/phpmyadmin/issues/4962">#4962</a>, <a href="https://github.com/phpmyadmin/phpmyadmin/issues/5437">#5437</a>, <a href="https://github.com/phpmyadmin/phpmyadmin/issues/6118">#6118</a>.</p>
Week 82015-07-19T00:00:00+00:00http://dan.ungureanu.me/gsoc-2015/2015/07/19/week-8<p>During the past week I worked on the linter and in order to provide better analysis I had to improve the library by creating new rules that check for errors.</p>
<p>At this moment, any code that is written in the SQL query box or in the console goes through the library which analyzes it and provides feedback. I hope that this feature will help many users spot their errors even before executing their queries and improve their work flow. Some of the errors are pretty difficult to detect and the overhead involved isn’t worth it, which means that not all errors are detected by the library. I tried to focus on syntax as much as possible.</p>
<p>During the next week, I will try improve the localization of the library, make error strings translatable and increase the overall code coverage. I am not sure to which extent I will be increase the code coverage, but I hope that I will be able to increase it by at least a few percents.</p>
<p>To see my progress, you can check out <a href="https://github.com/udan11/sql-parser">my library repository</a> or some of the pull requests (<a href="https://github.com/phpmyadmin/phpmyadmin/pull/1788">#1788</a> & <a href="https://github.com/phpmyadmin/phpmyadmin/pull/1799">#1799</a>) I submit this week.</p>
Week 72015-07-12T00:00:00+00:00http://dan.ungureanu.me/gsoc-2015/2015/07/12/week-7<p>During the past week I finished replacing the old parser. The remaining part of the code that required replacing was small, so I had enough time to also test it and so far it works fine.</p>
<p>There were fragments of code that relied on regular expressions for analysis and some of those were replaced during the process, but I believe that some of the remaining regular expressions won’t be replaced, because they perform good and faster than the parser would.</p>
<p>Most of the bugs I were aware of and tested with the new parser seem to be fixed. For the next week I planned on fixing the remaining bugs and implementing new features regarding the parser. I will improve the parsers to provide better, strict error messages so I can built the linter on top of it.</p>
<p>To see my progress, you can check out <a href="https://github.com/udan11/sql-parser">my library repository</a> or the pull request I submit for <a href="https://github.com/phpmyadmin/phpmyadmin/pull/1728">phpMyAdmin</a> and was merged today.</p>
Week 62015-07-05T00:00:00+00:00http://dan.ungureanu.me/gsoc-2015/2015/07/05/week-6<p>During this week I continued replacing code that was related to the old parsing library. The new library suffered a lot of changes too. Some of the most important are: implemented a builder, improved lots of statements, the library takes into consideration the SQL mode in some operations, lots of fixes, improved the documentation and the code coverage is now over 98%.</p>
<p>One of the most important tasks accomplished this week is that I finished refactoring <code>sql.lib.php</code>, <code>DisplayResults.class.php</code>, <code>Table.class.php</code> and a huge part of the code related to export.</p>
<p>I hope that the next week I will finish refactoring the old code and fix as many bugs as possible.</p>
<p>To see my progress, you can check out <a href="https://github.com/udan11/sql-parser">my library repository</a> or the pull request I submit for <a href="https://github.com/phpmyadmin/phpmyadmin/pull/1728">phpMyAdmin</a>.</p>
Week 52015-06-28T00:00:00+00:00http://dan.ungureanu.me/gsoc-2015/2015/06/28/week-5<p>During this week I paid a lot of attention to understanding the old code so I would not create any new bugs by mistake and I got the chance to find a few new ones (or had no knowledge of them previously).</p>
<p>Since most bugs are caused by edge cases that the old parser cannot handle I decided that the best approach to fixing them is to continue implementing the new library. This week the sql-parser library suffered quite a few changes and I got the chance to see how it behaves in real situations. It still lacks some functionality (e.g. query builder and query formatter) which are needed, but those are planed to be written later. For now, I implemented temporary methods that, given the conditions, seem to work as expected.</p>
<p>One of the most difficult parts was the code from <code>sql.lib.php</code> which has a high complexity, mixing some logic with view code and not being very consistent.</p>
<p>My task for the next two weeks is to refactor code related to the SQL library. I will definitely have to work more on <code>sql.lib.php</code>, being one of the key components of phpMyAdmin.</p>
<p>To see my progress, you can check out <a href="https://github.com/udan11/sql-parser">my library repository</a> or the pull request I submit for <a href="https://github.com/phpmyadmin/phpmyadmin/pull/1728">phpMyAdmin</a>.</p>
Week 42015-06-21T00:00:00+00:00http://dan.ungureanu.me/gsoc-2015/2015/06/21/week-4<p>Unfortunately this week was slow and I did not get to do very much. Now, that I am done with school, I am going to have more time to work on phpMyAdmin.</p>
<p>Some of the things I did this week(end): added multiple contexts and implemented them into phpMyAdmin along with a mechanism which switches the context according to the version of the database server, edited the way keywords were handled, removed the tokens array from parser’s output (it was redundant), fixed tests, completely refactored routine methods.</p>
<p>My task for the upcoming week is to implement new features and fix bugs, but I’ll continue replacing calls to the old library as well.</p>
<p>To see my progress, you can check out <a href="https://github.com/udan11/sql-parser">my library repository</a> or the pull request I submit for <a href="https://github.com/phpmyadmin/phpmyadmin/pull/1728">phpMyAdmin</a>.</p>
Week 32015-06-14T00:00:00+00:00http://dan.ungureanu.me/gsoc-2015/2015/06/14/week-3<p>This week I started implementing the parsing library in phpMyAdmin. For now, my task is to implement the library and partially refactor code that is related to the old usage of the library.</p>
<p>So far, I replaced some of the helper functions that were defined in the old parser. I replaced <code>PMA_SQP_isKeyword()</code>, <code>PMA_SQP_getAliasesFromQuery()</code> and <code>PMA_RTN_parseAllParameters()</code>. The <code>$PMA_SQPdata_forbidden_word</code> array has been replaced to the array that holds all forbidden words from the <code>Context</code> class which and will benefit from multiple contexts when finished.</p>
<p>The library have seen some improvements as well: implemented some utilities (that replace old functions of the phpMyAdmin parser), changed tests’ format, has better parser for fields and data types, etc.</p>
<p>My task for the upcoming week is to finish replacing all calls to the old parsing library and remove it completely. This week, I have two last exams and as soon as I am done, I am going to have more free time to work on phpMyAdmin.</p>
<p>To see my progress, you can check out <a href="https://github.com/udan11/sql-parser">my library repository</a> or the pull request I submit for <a href="https://github.com/phpmyadmin/phpmyadmin/pull/1728">phpMyAdmin</a>.</p>
Week 22015-06-07T00:00:00+00:00http://dan.ungureanu.me/gsoc-2015/2015/06/07/week-2<p>Today is the last day of the second week of Google Summer of Code. My task for this week was to continue working on the parser and the analyzer. Since last week, I got to rewrite a few parts of the library that required improvements, wrote unit tests that account for more than 90% of the code, wrote more explicit documentation, made sure that my code follows the PSR-2 standard, implemented new statement types (<code>CREATE FUNCTION</code>, <code>RENAME</code>, <code>REPLACE</code>, etc).</p>
<p>For the next two weeks, I planned to make use of the library I wrote during the past weeks in phpMyAdmin and refactor the code that uses it.</p>
<p>If you want to check out the code I wrote during the past weeks, you can find it in its repository <a href="https://github.com/udan11/sql-parser">here</a>.</p>
<p><em>NOTE</em>: The last commit is still <em>“Initial commit”</em> because I amended my last commit and did a force push.</p>
Initial commit.2015-05-31T00:00:00+00:00http://dan.ungureanu.me/gsoc-2015/2015/05/31/initial-commit<p>During this first week of Google Summer of Code I have been working on the SQL parsing library that I have to complete before continuing my work on phpMyAdmin.</p>
<p>Recently, I published the code I have been writing for the past weeks under a repository on my GitHub account. I decided to implement <code>SELECT</code>, <code>INSERT</code>, <code>DELETE</code>, <code>UPDATE</code> and <code>CREATE TABLE</code> statements first because they are some of the most used statements and analyzing their syntax helped me a lot when I sketched the first prototype.</p>
<p>What is interesting about these queries is that their syntax differs so much that it helped me find a balance between abstraction and performance that will help me to easily adapt current code base to implement other types of statements.</p>
<p>For the next week, I planned on finishing implementing the parsers for most statement types, which will let me continue my work on phpMyAdmin and start implementing it.</p>
<p>If you want to check out the code I wrote during the past weeks, you can find it in its repository <a href="https://github.com/udan11/sql-parser">here</a>.</p>
Hello, world!2015-04-27T00:00:00+00:00http://dan.ungureanu.me/gsoc-2015/2015/04/27/hello-world<p>Hello, world!</p>
<p>I am one of the participants in this year’s Google Summer of Code. During this summer, I will be working with the phpMyAdmin team to rewrite the SQL parser that is used in analyzing queries. My project’s title is “Parser and Analyzer Rewrite” and as the name suggests, the purpose of it is to rewrite a better SQL parser and analyzer that will be implemented in phpMyAdmin by the end of the summer. During this summer, Marc Delisle, who is one of the maintainers of phpMyAdmin and my mentor, is going to review my work.</p>
<p>To get a better idea of what my project consists, you can read the abstract of my proposal that can be found on Google Melange website <a href="https://www.google-melange.com/gsoc/project/details/google/gsoc2015/udan11/5639274879778816">here</a> and a copy of my entire proposal, which can be found <a href="https://drive.google.com/file/d/0B-VJ3ClMYRHFQzZzbjdaZ2J5UE0/view?usp=sharing">here</a>. I hope it will serve well any students that are planning to participate in GSoC next years.</p>