Giter VIP home page Giter VIP logo

sqlite-analyzer's People

Contributors

blundell avatar danybony avatar devisnik avatar electryc avatar fourlastor avatar frapontillo avatar friedger avatar johnjohndoe avatar juankysoriano avatar ouchadam avatar stefanhoth avatar takecare avatar tasomaniac avatar xrigau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sqlite-analyzer's Issues

View accessors assume nullable

When you create a table with a NOT NULL field and a view on that table

E.g.:

CREATE TABLE 'book' (
  book_number INTEGER NOT NULL
)

CREATE VIEW 'book_view' AS SELECT * FROM book;

The generated BookView.getBookNumber(cursor) is actually using boxed primitives and checking for null (and returning null if cursor.isNull(index) is true, which is never going to be the case) while the class Book.getBookNumber(cursor) is returning an int as expected.

Make part of the SQLiteProvider

I still think this should be part of the SQLiteProvider, perhaps with a build toggle if you want to opt in or not.

What are the positives for keeping it separate?

What are the positives for merging with SQLiteProvider?

Sorting of migration files too specific

We have been using this code generator for quite a while now. We have been using the following filename convention:

app.db_upgrade_<oldversion>_<newversion>.sql

One could argue if that is a sensible name but thats where we ended up with some time ago and it worked fine. Until travis decided to update their images with updated os / java.

After investigation it turned out that since the travis update the migration files where executed in the wrong order.

I tracked it down to:
https://github.com/novoda/sqlite-analyzer/blob/0.3.2/analyzer/src/main/java/com/novoda/sqlite/NumberedFilesComparator.java

Which assumes that the migration files are prefixed with <number>_. In our case the mentioned comparator would always return 0 and thus rely on the order of File.listFiles() which is not deterministic and results might have changed due to OS / openjdk vs oraclejdk / java version changes.

I think its good that users should to be aware of this requirement. We renamed the files now. But a more logical comparator would be better I think.

Allow duplicated column names

At the moment, views are forced to SELECT DISTINCT and manually select columns when duplicated names are found, such as _id

These duplicated columns should reuse the existing getters/setters and fields

Generate SQLOpenHelper

There should be a flag that enables generating SQLOpenHelper class based on migrations files (similar to sqlite provider)

Generated class skipped _id column

For the migrations/1_setup.sql file below, the generated class ignored _id. Is this intentionally left out, or is it because it begins with _?

CREATE TABLE IF NOT EXISTS 'GALLERY_ITEM'
    (_id TEXT PRIMARY KEY UNIQUE,
    title TEXT,
    description TEXT,
    page_views INTEGER,
    url TEXT,
    uploader TEXT,
    upvotes INTEGER,
    downvotes INTEGER,
    score INTEGER,
    is_album INTEGER,
    cover_image_id TEXT,
    album_layout TEXT,
    num_images INTEGER,
    image_mime_type TEXT,
    is_animated INTEGER,
    width INTEGER,
    height INTEGER,
    size_bytes INTEGER,
    bandwidth_bytes INTEGER,
    delete_hash TEXT,
    submission_datetime TEXT,
    first_synced_datetime TEXT,
    last_synced_datetime TEXT);

Allow Sqlite INTEGER type to be long

the sqlite INTEGER type can be up to 8-bytes long so can be a short, int, or long, but currently SQLite will only generate a int setter - could we add long setters too?

Generated get/setters don't use generated names constants

When you look at the code generated by this tool, you notice that the getters and setters look like this:

    public static int getId(android.database.Cursor cursor) {
        int index = cursor.getColumnIndexOrThrow("_id");
        return cursor.getInt(index);
    }

    public static void setId(int value, android.content.ContentValues values) {
        values.put("_id", value);
    }

They're using hardcoded strings to address the columns instead of using the corrects constants that are available in DB.Columns.[TableName].

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.