{"id":38676355,"url":"https://github.com/zaytiri/mieq","last_synced_at":"2026-01-17T10:01:07.631Z","repository":{"id":221128434,"uuid":"753208274","full_name":"zaytiri/MIEQ","owner":"zaytiri","description":"A simple query builder.","archived":false,"fork":false,"pushed_at":"2024-03-24T11:32:02.000Z","size":115,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-03-24T12:30:37.416Z","etag":null,"topics":["builder","query","queryable","simple","sql","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zaytiri.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-05T17:16:44.000Z","updated_at":"2024-02-05T19:00:43.000Z","dependencies_parsed_at":"2024-02-06T10:49:16.088Z","dependency_job_id":"cc4ac4ab-59a5-4e4c-8837-0c02f3c44410","html_url":"https://github.com/zaytiri/MIEQ","commit_stats":null,"previous_names":["zaytiri/mieq"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/zaytiri/MIEQ","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaytiri%2FMIEQ","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaytiri%2FMIEQ/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaytiri%2FMIEQ/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaytiri%2FMIEQ/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zaytiri","download_url":"https://codeload.github.com/zaytiri/MIEQ/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaytiri%2FMIEQ/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28505570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T06:57:29.758Z","status":"ssl_error","status_checked_at":"2026-01-17T06:56:03.931Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["builder","query","queryable","simple","sql","sqlite"],"created_at":"2026-01-17T10:00:46.730Z","updated_at":"2026-01-17T10:01:07.609Z","avatar_url":"https://github.com/zaytiri.png","language":"Java","readme":"# MIEQ\nA simple query builder to easily define your database and query through the data.\n\n# How to set up\n\n## IntelliJ IDE\n\n1. Download the latest version of _mieq-vx.x.x.jar_ file available in the Releases page.\n2. Move the download .jar file into the following folder:\n    ``\u003cyour_project\u003e/build/libs/``\n    \n    - If you don't want to use the suggested path you can create another folder for external libraries. You only have to add that custom folder as a library folder by right-clicking the folder and choosing 'Add as Library' option.\n      - \u003cimg src=\"https://github.com/zaytiri/MIEQ/blob/main/readme-images/1.png\" width=\"200\" height=\"400\" /\u003e\n3. Add the following dependency in your project's _build.gradle_ file:\n    ```\n    dependencies {\n        implementation files('build/libs/mieq-vx.x.x.jar')\n    }\n    ```\n4. Reload Gradle.\n5. Add ``requires MIEQ;`` in your _module-info.java_ file.\n\nNote: Replace the _vx.x.x_ for the downloaded version.\n\n## Android Studio\n\nFollow the steps in [this link](https://www.geeksforgeeks.org/how-to-import-external-jar-files-in-android-studio/).\n\n# How to use\n\nMIEQ has 2 main components:\n- Main statements, which lets you query the data (e.g. Insert, Select, Create, Update, Delete);\n- Database Schema, which lets you define the database schema and converts that to code.\n\n## Main statements\n\n### Options\n\n#### Set Close Connection\nEach query has the option to set if the connection should be closed after the next statement or not.\nUsing ``query.setCloseConnection(false)`` allows to have multiple statements without the connection closing after each statement done.\nBy default this is ``true``, meaning that after each statement the connection will close automatically.\n\nExample:\n\n```java\n        SelectQueryBuilder selectAll = new SelectQueryBuilder(connection.open());\n        selectAll.select()\n                .from(\"table\");\n\n        return selectAll.execute();\n```\n\nIn this example, the ``closeConnection`` variable is true, meaning that after executing the ``query``, the connection will be close automatically. ``query`` cannot be re-used anymore and a new instance must be created like new ``SelectQueryBuilder selectAFew = SelectQueryBuilder(connection.open())``.\n\nIn the Create example, by setting ``closeConnection`` to false, all statements inside the for loop will be done without interruptions. If set to false, the connection must be closed manually.\n\n### Create\n\n```java\n    private Connection connection; // Connection is a class from java.sql\n\n    // Opens the connection to the database. In this case we are using JDBC driver\n    public Connection open() {\n        try {\n            connection = DriverManager.getConnection(\"jdbc:sqlite:\" + path);\n        } catch (SQLException e) {\n            System.err.println(e.getMessage());\n        }\n        return connection;\n    }\n\n    // Closes the connection to the database.\n    public void close() {\n        try {\n            if (connection != null)\n                connection.close();\n        } catch (SQLException e) {\n            System.err.println(e.getMessage());\n        }\n    }\n\n    // Creates a database using MIEQ Create statement.\n    public void createDatabase() {\n        CreateTableQueryBuilder query = new CreateTableQueryBuilder(open());\n        query.setCloseConnection(false);\n\n        for (Table tb : schema.getTables()) {\n            query.create(tb);\n            query.execute();\n        }\n\n        close();\n    }\n```\n\n### More examples\n\nMore examples can be found in the following github repository: [taskerlyze - Repositories](https://github.com/zaytiri/taskerlyze/blob/main/api/src/main/java/personal/zaytiri/taskerlyze/app/persistence/repositories/base/Repository.java)\n\n## Database Schema\n\nTo use any statement, there must be tables available in code. To achieve this it's possible to define the database schema by providing a xml file with pre-defined rules.\n\nThe xml file must be put directly inside the resources folder, like:\n- resources\n    - \u003cdatabase_schema_name\u003e.xml\n\nExample:\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cdatabase\u003e\n    \u003cname\u003edatabase_name\u003c/name\u003e\n    \u003ctable\u003e \u003c!-- table one --\u003e\n        \u003cname\u003eone\u003c/name\u003e\n        \u003ccolumn\u003e\n            \u003cname\u003eid\u003c/name\u003e\n            \u003ctype\u003einteger\u003c/type\u003e\n            \u003cdefault\u003e1\u003c/default\u003e\n            \u003cisprimarykey\u003etrue\u003c/isprimarykey\u003e\n        \u003c/column\u003e\n        \u003ccolumn\u003e\n            \u003cname\u003ename\u003c/name\u003e\n            \u003ctype\u003etext\u003c/type\u003e\n            \u003cdefault\u003enull\u003c/default\u003e\n        \u003c/column\u003e\n    \u003c/table\u003e\n    \u003ctable\u003e \u003c!-- table two --\u003e\n        \u003cname\u003etwo\u003c/name\u003e\n        \u003ccolumn\u003e\n            \u003cname\u003eid\u003c/name\u003e\n            \u003ctype\u003einteger\u003c/type\u003e\n            \u003cdefault\u003e1\u003c/default\u003e\n            \u003cisprimarykey\u003etrue\u003c/isprimarykey\u003e\n        \u003c/column\u003e\n        \u003ccolumn\u003e\n            \u003cname\u003ename\u003c/name\u003e\n            \u003ctype\u003etext\u003c/type\u003e\n            \u003cdefault\u003enull\u003c/default\u003e\n        \u003c/column\u003e\n        \u003ccolumn\u003e\n            \u003cname\u003eupdated_at\u003c/name\u003e\n            \u003ctype\u003enumeric\u003c/type\u003e\n            \u003cdefault\u003enull\u003c/default\u003e\n        \u003c/column\u003e\n        \u003ccolumn\u003e\n            \u003cname\u003ecreated_at\u003c/name\u003e\n            \u003ctype\u003enumeric\u003c/type\u003e\n            \u003cdefault\u003enull\u003c/default\u003e\n        \u003c/column\u003e\n    \u003c/table\u003e\n\u003c/database\u003e\n```\n\n### Rules\n\n- database\n    - name: the name the database must have.\n    - table\n        - name: the name the table must have.\n        - column\n            - name: the name of the column.\n            - type: the type of the column. If using JDBC driver, the types can be any f the available types in the following lnk [JDBC Data Types](https://www.tutorialspoint.com/jdbc/jdbc-data-types.htm). This property is used when creating the table and to cast the column's value to this type. \n            - default: the default value of the column. Available default values are depending on the column's type. ``null`` is also a available option.\n            - is primary key: ``true`` if this column is a primary key or ``false`` if not. Only one column might have this property, since if the property is not set, the default value is ``false``.\n\n### How to use\n\nBefore any statements can be used to query the data, a schema must be available. The schema should be initilized when the program launches. To create the schema, the following code should be used:\n\n```java\n    Database database = Schema.getSchema( \u003cdatabase_schema_name\u003e );\n```\n\nIt returns the Database class containing a list of Table, where each table also contains a list of Column. This class is mainly used to easily create each statement to query the data instead of using hardcoded values inside the statements. This usage can be also found in the [More examples](#more-examples) section.\n\nEach class (Database \u003e Table \u003e Column) has useful methods, such as:\n- Database\n    - getName\n    - getTables\n    - getTable ( name )\n    - (+ all respective setters)\n\n- Table\n    - getName\n    - getColumns\n    - getColumn ( name )\n    - getAllColumnsExcept ( listOfColumnNamesToExclude )\n    - (+ all respective setters)\n\n- Column\n    - getName\n    - getTableName\n    - getType\n    - getDefaultValue\n    - getIsPrimaryKey\n    - (+ all respective setters)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaytiri%2Fmieq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzaytiri%2Fmieq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaytiri%2Fmieq/lists"}