Skip to content

Commit f5a1073

Browse files
committed
update sorma2
1 parent a123362 commit f5a1073

File tree

6 files changed

+24
-19
lines changed

6 files changed

+24
-19
lines changed

sorma2/README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Sorma<sup>2</sup> - Simple ORM(Android)<sup>2</sup>
1+
# Sorma<sup>2</sup> - Simple ORM(Android)<sup>2</sup> <sub>(also for Desktop)<sub>
22

33
It is based on the wonderful https://github.com/maskarade/Android-Orma by [FUJI Goro](https://github.com/gfx)
44
<br>
55
<br>
66
This is a rewrite in pure java, to generate most stuff you need and then add it to your project
77
either as a ```.jar file``` or as ```java source```.<br>
8-
You still need to add ```sqlite-jdbc-3.51.0.0.jar``` to your project to use it.<br>
8+
You still need to add ```sqlite-jdbc-3.51.1.0.jar``` to your project to use it.<br>
99
<br><br>
1010
~~sadly [sqlite-jdbc](https://github.com/xerial/sqlite-jdbc) project decided that it needs ```slf4j-api jar``` (for no good reason).~~
1111
this was solved by: https://github.com/xerial/sqlite-jdbc/pull/1178
@@ -40,7 +40,7 @@ public class Person
4040

4141
now create the Java sources with the Java SORMA2 Generator. <b>you need at least java 17</b>.<br>
4242
```bash
43-
java -classpath ".:sqlite-jdbc-3.51.0.0.jar:sorma2.jar" \
43+
java -classpath ".:sqlite-jdbc-3.51.1.0.jar:sorma2.jar" \
4444
com/zoffcc/applications/sorm/Generator "gen"
4545
```
4646

@@ -85,10 +85,15 @@ see: https://github.com/zoff99/sorma2/tree/master/test
8585

8686
<img src="https://github.com/zoff99/sorma2/releases/download/nightly/console_screen.png" width="70%">
8787

88-
Use the `sorma_generated.jar` (that is generated in the `gen` directory) and `sqlite-jdbc-3.51.0.0.jar` for the Java project.<br>
88+
Use the `sorma_generated.jar` (that is generated in the `gen` directory) and `sqlite-jdbc-3.51.1.0.jar` for the Java project.<br>
8989
Check `TestSorma.java` for an Example usage.
9090
<br>
9191

92+
Desktop (Linux / Windows / macOS) Gradle Example Project
93+
------------------------
94+
see: https://github.com/zoff99/sorma2/tree/master/example_gradle_linux
95+
<br>
96+
9297

9398
<br>
9499
Any use of this project's code by GitHub Copilot, past or present, is done

sorma2/do_compile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#! /bin/bash
22

33
javac \
4-
-cp "sqlite-jdbc-3.51.0.0.jar" \
4+
-cp "sqlite-jdbc-3.51.1.0.jar" \
55
com/zoffcc/applications/sorm/Column.java \
66
com/zoffcc/applications/sorm/Index.java \
77
com/zoffcc/applications/sorm/Log.java \

sorma2/do_run.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#! /bin/bash
22

33
java \
4-
-classpath ".:sqlite-jdbc-3.51.0.0.jar:sorma2.jar" \
4+
-classpath ".:sqlite-jdbc-3.51.1.0.jar:sorma2.jar" \
55
com/zoffcc/applications/sorm/Generator "gen" || exit 1
66

77
cd gen/
88
javac \
9-
-cp "sqlite-jdbc-3.51.0.0.jar" \
9+
-cp "sqlite-jdbc-3.51.1.0.jar" \
1010
com/zoffcc/applications/sorm/*.java && \
1111
jar cf sorma_generated.jar com/zoffcc/applications/sorm/*.class && \
1212
cp sorma_generated.jar ../test/ && \
@@ -15,12 +15,12 @@ cd ../ || exit 1
1515
# use generated custom jar
1616
cd test/
1717
javac \
18-
-classpath ".:sqlite-jdbc-3.51.0.0.jar:sorma_generated.jar" \
18+
-classpath ".:sqlite-jdbc-3.51.1.0.jar:sorma_generated.jar" \
1919
org/example/TestSorma.java || exit 1
2020

2121
rm -f main.db
2222

2323
java \
24-
-classpath ".:sqlite-jdbc-3.51.0.0.jar:sorma_generated.jar" \
24+
-classpath ".:sqlite-jdbc-3.51.1.0.jar:sorma_generated.jar" \
2525
org/example/TestSorma || exit 1
2626

sorma2/gen/com/zoffcc/applications/sorm/OrmaDatabase.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -620,28 +620,28 @@ public static void init(final int db_schema_version) throws Exception
620620
// HINT: try to read "PRAGMA user_version" and see if there is some legacy value there
621621
current_db_schema_version = get_current_db_legacy_version();
622622
}
623-
Log.i(TAG, "trifa:current_db_version=" + current_db_schema_version);
623+
Log.i(TAG, "INIT:current_db_version=" + current_db_schema_version);
624624
if ((current_db_schema_version < 0) || (THIS_DB_SCHEMA_VERSION < 0))
625625
{
626-
Log.i(TAG, "trifa:current_db_schema_version and/or THIS_DB_SCHEMA_VERSION are negative numbers, this is not allowed!");
626+
Log.i(TAG, "INIT:current_db_schema_version and/or THIS_DB_SCHEMA_VERSION are negative numbers, this is not allowed!");
627627
}
628628
if ((current_db_schema_version == 0) && (THIS_DB_SCHEMA_VERSION == 0))
629629
{
630-
Log.i(TAG, "trifa:current_db_schema_version and THIS_DB_SCHEMA_VERSION are both 0, this is not allowed!");
630+
Log.i(TAG, "INIT:current_db_schema_version and THIS_DB_SCHEMA_VERSION are both 0, this is not allowed!");
631631
}
632632
if (current_db_schema_version < THIS_DB_SCHEMA_VERSION)
633633
{
634634
for (int cur=current_db_schema_version;cur<THIS_DB_SCHEMA_VERSION;cur++)
635635
{
636-
Log.i(TAG, "trifa:calling schema upgrade callback function for " + cur + " -> " + (cur + 1));
636+
Log.i(TAG, "INIT:calling schema upgrade callback function for " + cur + " -> " + (cur + 1));
637637
if (schema_upgrade_callback_function != null)
638638
{
639639
schema_upgrade_callback_function.upgrade(cur, (cur + 1));
640640
}
641641
}
642642
}
643643
current_db_schema_version = update_db(current_db_schema_version);
644-
Log.i(TAG, "trifa:new_db_version=" + current_db_schema_version);
644+
Log.i(TAG, "INIT:new_db_version=" + current_db_schema_version);
645645
// --------------- CREATE THE DATABASE ---------------
646646
// --------------- CREATE THE DATABASE ---------------
647647
// --------------- CREATE THE DATABASE ---------------

sorma2/o1.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -620,28 +620,28 @@ public class OrmaDatabase
620620
// HINT: try to read "PRAGMA user_version" and see if there is some legacy value there
621621
current_db_schema_version = get_current_db_legacy_version();
622622
}
623-
Log.i(TAG, "trifa:current_db_version=" + current_db_schema_version);
623+
Log.i(TAG, "INIT:current_db_version=" + current_db_schema_version);
624624
if ((current_db_schema_version < 0) || (THIS_DB_SCHEMA_VERSION < 0))
625625
{
626-
Log.i(TAG, "trifa:current_db_schema_version and/or THIS_DB_SCHEMA_VERSION are negative numbers, this is not allowed!");
626+
Log.i(TAG, "INIT:current_db_schema_version and/or THIS_DB_SCHEMA_VERSION are negative numbers, this is not allowed!");
627627
}
628628
if ((current_db_schema_version == 0) && (THIS_DB_SCHEMA_VERSION == 0))
629629
{
630-
Log.i(TAG, "trifa:current_db_schema_version and THIS_DB_SCHEMA_VERSION are both 0, this is not allowed!");
630+
Log.i(TAG, "INIT:current_db_schema_version and THIS_DB_SCHEMA_VERSION are both 0, this is not allowed!");
631631
}
632632
if (current_db_schema_version < THIS_DB_SCHEMA_VERSION)
633633
{
634634
for (int cur=current_db_schema_version;cur<THIS_DB_SCHEMA_VERSION;cur++)
635635
{
636-
Log.i(TAG, "trifa:calling schema upgrade callback function for " + cur + " -> " + (cur + 1));
636+
Log.i(TAG, "INIT:calling schema upgrade callback function for " + cur + " -> " + (cur + 1));
637637
if (schema_upgrade_callback_function != null)
638638
{
639639
schema_upgrade_callback_function.upgrade(cur, (cur + 1));
640640
}
641641
}
642642
}
643643
current_db_schema_version = update_db(current_db_schema_version);
644-
Log.i(TAG, "trifa:new_db_version=" + current_db_schema_version);
644+
Log.i(TAG, "INIT:new_db_version=" + current_db_schema_version);
645645
// --------------- CREATE THE DATABASE ---------------
646646
// --------------- CREATE THE DATABASE ---------------
647647
// --------------- CREATE THE DATABASE ---------------

0 commit comments

Comments
 (0)