Mar 9, 2025 Replies: 45 MiniORMUtils Version: 6.04 GitHub: https://github.com/pyhoon/MiniORMUtils-B4X This library can be use for creating database tables and performing CRUD operations. It is suitable for B4X apps, non-UI web app or REST API servers. It is useful to return the query results as JSON since the rows are list of maps. Currently it supports SQLite (for B4A, B4i, B4J), MariaDB and MySQL (for B4J only). Project Template: [B4X] [Project Template] MiniORM Examples: Initialize MiniORM B4X: Private DB As MiniORM DB.Initialize Set file name for SQLite B4X: DB.Settings.DBFile = "blog.db" Set ORMSettings for MySQL B4X: DB.Initialize Dim MS As MiniORMSettings MS.Initialize MS.DBType = DB.MYSQL MS.JdbcUrl = "jdbc:mysql://{DbHost}:{DbPort}/{DbName}?characterEncoding=utf8&useSSL=False" MS.Driver = "com.mysql.cj.jdbc.Driver" MS.DBName = "blog" MS.DbHost = "localhost" MS.User = "root" MS.Password = "password" DB.Settings = MS Check if database exist (SQLite) B4X: If Not(DB.Exist) Then LogColor($"${DB.DBType} database not found!"$, COLOR_RED) CreateDatabase End If Create Database B4X: Dim Success As Boolean = DB.CreateSQLite Connect to Database B4X: DB.Open Create Table B4X: DB.Table = "categories" DB.Columns = Array("category_code", "category_name") DB.Create Create Table (with column definitions) B4X: DB.Table = "products" DB.Columns.Add(CreateMap("N": "category_id", "T": DB.INTEGER)) DB.Columns.Add(CreateMap("N": "product_code", "S": 12)) DB.Columns.Add(CreateMap("N": "product_name")) DB.Columns.Add(CreateMap("N": "product_price", "T": DB.DECIMAL, "S": "10,2", "D": 0.0)) DB.Columns.Add(CreateMap("N": "product_image", "T": DB.BLOB)) DB.Foreign = "category_id" DB.References("categories", "id") DB.Create Insert Rows B4X: DB.Columns = Array("category_id", "product_code", "product_name", "product_price") DB.Inserts = Array(2, "T001", "Teddy Bear", 99.9) DB.Inserts = Array(1, "H001", "Hammer", 15.75) DB.Inserts = Array(2, "T002", "Optimus Prime", 1000) Execute NonQuery Batch B4X: Wait For (DB.ExecuteBatchAsync) Complete (Success As Boolean) If Success Then Log("Database is created successfully!") Else Log("Database creation failed!") End If Select All Rows B4X: DB.Table = "categories" DB.Query If DB.Error.IsInitialized Then Log(DB.Error.Message) Else Dim Items As List = DB.Results End If Return single row B4X: DB.Find(3) If DB.Found Then Log(DB.First) End If Update Row B4X: DB.Table = "products" DB.Columns = Array("category_id", "product_code", "product_name", "product_price", "modified_date") DB.Parameters = Array(Category, Code, Name, Price, Modified_Date) DB.Condition = "id = ?" DB.Parameter = 2 Spoiler: Version 1 [B4X] MiniORMUtils - SQL Query Builder Updates Version 2.00 is available https://www.b4x.com/android/forum/threads/b4x-miniormutils.166030/ MiniORMUtils Version: 1.17 This library can be use for creating db schema and performing CRUD operations. It is suitable for Web API Template or any database system. Currently it supports... www.b4x.com Attachments MiniORMUtils.b4xlib MiniORMUtils.b4xlib 13.5 KB · Views: 159 Last edited: Aug 28, 2026 Click to expand...
MiniORMUtils Version: 6.04 GitHub: https://github.com/pyhoon/MiniORMUtils-B4X This library can be use for creating database tables and performing CRUD operations. It is suitable for B4X apps, non-UI web app or REST API servers. It is useful to return the query results as JSON since the rows are list of maps. Currently it supports SQLite (for B4A, B4i, B4J), MariaDB and MySQL (for B4J only). Project Template: [B4X] [Project Template] MiniORM Examples: Initialize MiniORM B4X: Private DB As MiniORM DB.Initialize Set file name for SQLite B4X: DB.Settings.DBFile = "blog.db" Set ORMSettings for MySQL B4X: DB.Initialize Dim MS As MiniORMSettings MS.Initialize MS.DBType = DB.MYSQL MS.JdbcUrl = "jdbc:mysql://{DbHost}:{DbPort}/{DbName}?characterEncoding=utf8&useSSL=False" MS.Driver = "com.mysql.cj.jdbc.Driver" MS.DBName = "blog" MS.DbHost = "localhost" MS.User = "root" MS.Password = "password" DB.Settings = MS Check if database exist (SQLite) B4X: If Not(DB.Exist) Then LogColor($"${DB.DBType} database not found!"$, COLOR_RED) CreateDatabase End If Create Database B4X: Dim Success As Boolean = DB.CreateSQLite Connect to Database B4X: DB.Open Create Table B4X: DB.Table = "categories" DB.Columns = Array("category_code", "category_name") DB.Create Create Table (with column definitions) B4X: DB.Table = "products" DB.Columns.Add(CreateMap("N": "category_id", "T": DB.INTEGER)) DB.Columns.Add(CreateMap("N": "product_code", "S": 12)) DB.Columns.Add(CreateMap("N": "product_name")) DB.Columns.Add(CreateMap("N": "product_price", "T": DB.DECIMAL, "S": "10,2", "D": 0.0)) DB.Columns.Add(CreateMap("N": "product_image", "T": DB.BLOB)) DB.Foreign = "category_id" DB.References("categories", "id") DB.Create Insert Rows B4X: DB.Columns = Array("category_id", "product_code", "product_name", "product_price") DB.Inserts = Array(2, "T001", "Teddy Bear", 99.9) DB.Inserts = Array(1, "H001", "Hammer", 15.75) DB.Inserts = Array(2, "T002", "Optimus Prime", 1000) Execute NonQuery Batch B4X: Wait For (DB.ExecuteBatchAsync) Complete (Success As Boolean) If Success Then Log("Database is created successfully!") Else Log("Database creation failed!") End If Select All Rows B4X: DB.Table = "categories" DB.Query If DB.Error.IsInitialized Then Log(DB.Error.Message) Else Dim Items As List = DB.Results End If Return single row B4X: DB.Find(3) If DB.Found Then Log(DB.First) End If Update Row B4X: DB.Table = "products" DB.Columns = Array("category_id", "product_code", "product_name", "product_price", "modified_date") DB.Parameters = Array(Category, Code, Name, Price, Modified_Date) DB.Condition = "id = ?" DB.Parameter = 2 Spoiler: Version 1 [B4X] MiniORMUtils - SQL Query Builder Updates Version 2.00 is available https://www.b4x.com/android/forum/threads/b4x-miniormutils.166030/ MiniORMUtils Version: 1.17 This library can be use for creating db schema and performing CRUD operations. It is suitable for Web API Template or any database system. Currently it supports... www.b4x.com
aeric Expert Licensed User Longtime User Apr 18, 2026 #41 Version: 5.40 What's Changed Update ExecuteBatchAsync sub Set QueryAddToBatch to False Clear batch statement and parameters
Version: 5.40 What's Changed Update ExecuteBatchAsync sub Set QueryAddToBatch to False Clear batch statement and parameters
aeric Expert Licensed User Longtime User Apr 28, 2026 #42 Version: 5.50 What's New Update Join sub (breaking) Update Query sub Update SelectFromObject sub Update BuildColumns sub Update ExecuteScalar sub Update ExecuteScalar2 sub Update getCondition sub Update setCondition sub Update setConditions sub Update setParameters sub Update WhereParams sub Update Save sub Update Save3 sub Update Delete sub Update Destroy sub Update SoftDelete sub Update getStatement sub Remove setJoin sub Remove getJoins sub Remove CreateORMColumn sub Remove CreateORMJoin sub Add IsNotNull sub (Private) Add ReturnNewRow property Add QueryAutoClose property
Version: 5.50 What's New Update Join sub (breaking) Update Query sub Update SelectFromObject sub Update BuildColumns sub Update ExecuteScalar sub Update ExecuteScalar2 sub Update getCondition sub Update setCondition sub Update setConditions sub Update setParameters sub Update WhereParams sub Update Save sub Update Save3 sub Update Delete sub Update Destroy sub Update SoftDelete sub Update getStatement sub Remove setJoin sub Remove getJoins sub Remove CreateORMColumn sub Remove CreateORMJoin sub Add IsNotNull sub (Private) Add ReturnNewRow property Add QueryAutoClose property
aeric Expert Licensed User Longtime User May 2, 2026 #43 Version: 5.60 What's New Rename ReturnNewRow property to ReturnRow Last edited: May 3, 2026
aeric Expert Licensed User Longtime User Jul 30, 2026 #44 Version: 6.02 Support for Pakai Server Ultimate v6.99 template accidentally set "L" for column length shortcut instead of using "S" for size. Last edited: Jul 30, 2026
Version: 6.02 Support for Pakai Server Ultimate v6.99 template accidentally set "L" for column length shortcut instead of using "S" for size.
aeric Expert Licensed User Longtime User Aug 28, 2026 #46 Version: 6.04 Removed QueryRaw public property Added FinalizeQuery (private)