Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8307859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:38:02+00:00 2026-06-08T18:38:02+00:00

My mate made the database for my Android app. For example, one of the

  • 0

My mate made the database for my Android app. For example, one of the tables is created like this:

CREATE TABLE table1(
    id_fields_starring INTEGER PRIMARY KEY AUTOINCREMENT
    , fields_descriptor_id INTEGER NOT NULL
    , starring_id INTEGER NOT NULL
    , form_mandatory INTEGER NOT NULL DEFAULT 1
    , form_visible INTEGER NOT NULL DEFAULT 1
    , FOREIGN KEY(fields_descriptor_id) REFERENCES pr_fields_descriptor(id_fields_descriptor) ON DELETE CASCADE ON UPDATE CASCADE
    , FOREIGN KEY(starring_id) REFERENCES starring(id_starring) ON DELETE CASCADE ON UPDATE CASCADE
)

From the fields of a table I need to know which of them is INTEGER NOT NULL and which is INTEGER NOT NULL DEFAULT 1, because for the first case I must create dinamically an EditText and for the second case I must create a CheckBox. Any idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:38:04+00:00Added an answer on June 8, 2026 at 6:38 pm

    Calling:

    PRAGMA table_info(table1);
    

    will dump the table information, e.g.

    cid|name                 |type    |notnull |dflt_value |pk
    0  |id_fields_starring   |INTEGER |0       |           |1
    1  |fields_descriptor_id |INTEGER |1       |           |0
    2  |starring_id          |INTEGER |1       |           |0
    3  |form_mandatory       |INTEGER |1       |1          |0
    4  |form_visible         |INTEGER |1       |1          |0
    

    and simply find the row in the cursor with notnull=1 and dflt_value=1


    Edit:

    To list all columns defined as INTEGER NOT NULL DEFAULT 1 this would work (helper is your instance of SQLiteOpenHelper):

    SQLiteDatabase db = helper.getWritableDatabase();
    Cursor cursor = db.rawQuery("PRAGMA table_info(table1)", null);
    try {
        int nameIdx = cursor.getColumnIndexOrThrow("name");
        int typeIdx = cursor.getColumnIndexOrThrow("type");
        int notNullIdx = cursor.getColumnIndexOrThrow("notnull");
        int dfltValueIdx = cursor.getColumnIndexOrThrow("dflt_value");
        ArrayList<String> integerDefault1NotNull = new ArrayList<String>();
        while (cursor.moveToNext()) {
            String type = cursor.getString(typeIdx);
            if ("INTEGER".equals(type)) {
                // Integer column
                if (cursor.getInt(notNullIdx) == 1) {
                    // NOT NULL
                    String defaultValue = cursor.getString(dfltValueIdx);
                    if ("1".equals(defaultValue)) {
                        integerDefault1NotNull.add(cursor.getString(nameIdx));
                    }
                }
            }
        }
        System.out.println("integerDefault1NotNull now contains a list of all columns " +
                " defined as INTEGER NOT NULL DEFAULT 1, " + integerDefault1NotNull);
    } finally {
        cursor.close();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this tag: <a id=link1 runat=server href=http://www.selab.isti.cnr.it/ws-mate/example.pdf title=PDF>Open iFrame</a> This link opens a
I have rjecnik.txt file that looks like this mate sime, jure stipica gujo, prvi
I found this example in jboss's documentation. select new Family(mother, mate, offspr) from DomesticCat
My office mate created a web service application to be consumed by a .Net
I'm using MATE on an Adobe Flex project for MVC. On one of our
I've thought that mate is virtually the same as 'open -a TextMate.app', but I
My mate created a project from SVN with bad hostname - 192.168.0.100. - yes,
I made this program that should flood fill the matrix but something went wrong.
When I have this PHP script. <?php exec('/usr/local/bin/mate hello.txt'); ?> It doesn't work on
So yesterday my mate and myself had this duscussion about the architecture of this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.