Qortal Core - Main Code Repository Decentralized Data Network - Blockchain - TRUE Cross-Chain Trading - Application and Website Hosting - Much More - Qortal is the future internet infrastructure for the global digital world.
Go to file
catbref 3d78d5dad9 More refactoring - DOES NOT COMPILE
qora.* packages are business logic/handler/processing
data.* packages are "value objects" or are they "business objects"?

toBytes(), fromBytes() (which used to be called parse()) and toJSON() moved to transform.* packages

new issues:

Lost control of SQL Transactions. Previously, some class "knew" whether to call COMMIT or not.
e.g. simply saving a payment transaction would involve updating Transactions table first, then the PaymentTransactions table after (to satisfy foreign key constraints) then commit.
Processing a block would involve a new transaction, a savepoint, a rollback and then maybe a further commit or rollback.
Not sure how this is going to work with the repository, especially if business logic isn't supposed to be aware of such things.

Growing number of stupid try-catch blocks. Probably best to ditch TransformationException (was ParseException) and throw IllegalStateExceptions instead as they're "unchecked".

What happens if the repository fails to save() to the database? It can't throw SQLException any more as that has no meaning outside the repository. Ditto with delete().
2018-06-08 17:40:27 +01:00
.settings more work on DAO - for illustrative purposes only!! 2018-06-08 13:30:12 +01:00
src More refactoring - DOES NOT COMPILE 2018-06-08 17:40:27 +01:00
.classpath Initial stab at migrating to HSQLDB for Qora gen2 2018-05-16 11:46:44 +01:00
.gitignore Initial stab at migrating to HSQLDB for Qora gen2 2018-05-16 11:46:44 +01:00
.project Initial stab at migrating to HSQLDB for Qora gen2 2018-05-16 11:46:44 +01:00
NOTES.md Create NOTES.md 2018-05-16 12:59:15 +01:00
pom.xml More work on transactions/blocks 2018-06-04 11:45:40 +01:00
README.md Create README.md 2018-05-16 12:22:48 +01:00

Qora2

To use:

  • Use maven to fetch dependencies.
  • Build project.
  • Fire up an old-gen Qora node.
  • Run src/test/update.java as a JUnit test to build DB structure.
  • Run src/test/migrate.java as a JUnit test to migrate old Qora blocks to DB.

You should now be able to run src/test/load.java and src/test/save.java as JUnit tests demonstrating loading/saving Transactions from/to database.

You can also examine the migrated database using HSQLDB's "sqltool".

It's a good idea to install "rlwrap" (ReadLine wrapper) too as sqltool doesn't support command history/editing!

Typical command line for sqltool would be:

rlwrap java -cp ${HSQLDB_JAR}:${SQLTOOL_JAR} org.hsqldb.cmdline.SqlTool --rcFile=${SQLTOOL_RC} qora

${HSQLDB_JAR} contains pathname to hsqldb-2.4.0.jar, typically ${HOME}/.m2/repository/org/hsqldb/hsqldb/2.4.0/hsqldb-2.4.0.jar

${SQLTOOL_JAR} contains pathname to where you downloaded sqltool-2.2.6.jar

${SQLTOOL_RC} contains pathname to a text file describing Qora2 database, e.g. ${HOME}/.sqltool.rc, with contents like:

urlid qora
url jdbc:hsqldb:file:db/test
username SA
password

You could change the line url jdbc:hsqldb:file:db/test to use a full pathname for easier use.

Another idea is to assign a shell alias in your .bashrc like:

alias sqltool='rlwrap java -cp ${HSQLDB_JAR}:${SQLTOOL_JAR} org.hsqldb.cmdline.SqlTool --rcFile=${SQLTOOL_RC}'

So you can simply type: sqltool qora