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 015f4fa725 Rework DB connection arg passing
Too many calls needing Connection object in args when they're only
simple database reads. Even worse, some methods had database-less
counterparts with different outputs, e.g. toJSON().

Now Connections can be requested from the pool for general database
read scenarios. Code paths that might perform a multi-statement
database transaction still require a Connection arg passed around
as the database transaction are local to that Connection.

In light of above, added support for database opening, closing,
setting URL.

Fixed out of bounds array index bug in unknown-length version of DB.getResultSetBytes().

Fixed Block's lazy-instantiation of Transactions.
Implemented Block's isSignatureValid().

Fixed bug in Crypto.isValidAddress() which was using the wrong bytes.

Fix GenesisTransaction generic constructor calling super with PaymentTransaction type!
Fix GenesisTransaction signature constructor using wrong column indexes from ResultSet.

In Transaction, don't expect CREATOR_LENGTH bytes from database in case we're dealing
with a GenesisTransaction where the creator's public key is only 8 bytes long.

Improvements to unit tests, including changing migrate so it can be run repeatedly to do
incremental migrations.
2018-05-24 11:26:59 +01:00
.settings Initial stab at migrating to HSQLDB for Qora gen2 2018-05-16 11:46:44 +01:00
src Rework DB connection arg passing 2018-05-24 11:26:59 +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 Initial stab at migrating to HSQLDB for Qora gen2 2018-05-16 11:46:44 +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