Bug 143329 - Use constants of sqlite3 directly for status of SQL result in webdatabase
Summary: Use constants of sqlite3 directly for status of SQL result in webdatabase
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Gyuyoung Kim
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-01 22:49 PDT by Gyuyoung Kim
Modified: 2015-04-05 13:45 PDT (History)
5 users (show)

See Also:


Attachments
Patch (26.28 KB, patch)
2015-04-01 22:56 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (26.34 KB, patch)
2015-04-01 23:27 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (26.43 KB, patch)
2015-04-02 16:18 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (29.43 KB, patch)
2015-04-03 06:23 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews107 for mac-mavericks-wk2 (558.32 KB, application/zip)
2015-04-03 07:33 PDT, Build Bot
no flags Details
Patch (29.46 KB, patch)
2015-04-03 08:23 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (125.07 KB, patch)
2015-04-03 18:44 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (124.92 KB, patch)
2015-04-03 20:19 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gyuyoung Kim 2015-04-01 22:49:06 PDT
In webdatabase, it has used constants vairables as well as using SQL constants directly. If SQL constants are changed, we should modify many files. Besides it causes to use if~else statement which consumes more cpu cycles compared to switch~case. This patch introduces SQLResultType eunm type, and use it. Additionally if~else statment is changed by switch~case.
Comment 1 Gyuyoung Kim 2015-04-01 22:56:19 PDT
Created attachment 249963 [details]
Patch
Comment 2 Gyuyoung Kim 2015-04-01 23:27:52 PDT
Created attachment 249964 [details]
Patch
Comment 3 Gyuyoung Kim 2015-04-02 16:18:52 PDT
Created attachment 250016 [details]
Patch
Comment 4 Gyuyoung Kim 2015-04-03 06:23:28 PDT
Created attachment 250067 [details]
Patch
Comment 5 Build Bot 2015-04-03 07:33:39 PDT
Comment on attachment 250067 [details]
Patch

Attachment 250067 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/4584866775564288

New failing tests:
fast/fixed-layout/fixed-layout.html
Comment 6 Build Bot 2015-04-03 07:33:42 PDT
Created attachment 250069 [details]
Archive of layout-test-results from ews107 for mac-mavericks-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-mavericks-wk2  Platform: Mac OS X 10.9.5
Comment 7 Gyuyoung Kim 2015-04-03 08:22:14 PDT
(In reply to comment #5)
> Comment on attachment 250067 [details]
> Patch
> 
> Attachment 250067 [details] did not pass mac-wk2-ews (mac-wk2):
> Output: http://webkit-queues.appspot.com/results/4584866775564288
> 
> New failing tests:
> fast/fixed-layout/fixed-layout.html

Looks unrelated test failure.
Comment 8 Gyuyoung Kim 2015-04-03 08:23:42 PDT
Created attachment 250074 [details]
Patch
Comment 9 Darin Adler 2015-04-03 13:35:19 PDT
Comment on attachment 250074 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=250074&action=review

I don’t understand why we are defining our own enum. Why not use the SQLite3 constants directly?

> Source/WebCore/platform/sql/SQLiteDatabase.h:48
> +typedef enum {

In C++ preferred syntax is enum X { } rather than typedef enum { } X;

Also, in new code we prefer to use enum class. So this should be:

    enum class SQLResult {
        Done = SQLITE_DONE,
        ...
    }

Then the constants are named SQLResult::Done.
Comment 10 Gyuyoung Kim 2015-04-03 18:44:45 PDT
Created attachment 250113 [details]
Patch
Comment 11 Gyuyoung Kim 2015-04-03 18:47:56 PDT
(In reply to comment #9)
> Comment on attachment 250074 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=250074&action=review
> 
> I don’t understand why we are defining our own enum. Why not use the SQLite3
> constants directly?

As I wrote in ChangeLog, it can cause to modify many files if constants of SQLite3 are changed. However If you think to use the constants directly, I don't object to do it. Updated patch uses the constants directly.
 
> > Source/WebCore/platform/sql/SQLiteDatabase.h:48
> > +typedef enum {
> 
> In C++ preferred syntax is enum X { } rather than typedef enum { } X;
> 
> Also, in new code we prefer to use enum class. So this should be:
> 
>     enum class SQLResult {
>         Done = SQLITE_DONE,
>         ...
>     }
> 
> Then the constants are named SQLResult::Done.

If I change name of type, I had to modify more files which have used existing own constants variables. However new patch just uses SQLite3 constatns directly.
Comment 12 Gyuyoung Kim 2015-04-03 20:19:20 PDT
Created attachment 250117 [details]
Patch
Comment 13 Gyuyoung Kim 2015-04-04 20:07:02 PDT
Darin, I wonder what do you think about updated patch.
Comment 14 WebKit Commit Bot 2015-04-05 13:45:28 PDT
Comment on attachment 250117 [details]
Patch

Clearing flags on attachment: 250117

Committed r182365: <http://trac.webkit.org/changeset/182365>
Comment 15 WebKit Commit Bot 2015-04-05 13:45:33 PDT
All reviewed patches have been landed.  Closing bug.