[maven-release-plugin] prepare for next development iteration
[maven-release-plugin] copy for tag openhms-parent-2.0.10
[maven-release-plugin] prepare release openhms-parent-2.0.10
start including sbom
update parent pom dep
update parent pom dep
[maven-release-plugin] prepare for next development iteration
[maven-release-plugin] copy for tag openhms-parent-2.0.9
[maven-release-plugin] prepare release openhms-parent-2.0.9
update for new sonatype repository publishing
[maven-release-plugin] rollback the release of openhms-parent-2.0.8
[maven-release-plugin] prepare for next development iteration
[maven-release-plugin] copy for tag openhms-parent-2.0.8
[maven-release-plugin] prepare release openhms-parent-2.0.8
update deployment url
BinaryCondition is op missing
if you look here https://openhms.sourceforge.io/sqlbuilder/syntax_reference.html#Conditions , you can see the "is [not] null" condition documented as https://openhms.sourceforge.io/sqlbuilder/apidocs/com/healthmarketscience/sqlbuilder/UnaryCondition.Op.html (it is a UnaryCondition not a BinaryCondition). in the future, it's best to start asking questions here https://sourceforge.net/p/openhms/discussion/803425/ before creating bugs.
if you look here https://openhms.sourceforge.io/sqlbuilder/syntax_reference.html#Conditions , you can see the "is [not] null" condition documented as https://openhms.sourceforge.io/sqlbuilder/apidocs/com/healthmarketscience/sqlbuilder/UnaryCondition.Op.html (it is a UnaryCondition not a BinaryCondition).
BinaryCondition is op missing
thanks for sharing! that's a nifty little solution to that problem. i'm glad to hear that rmiio is still useful. one minor comment. InputStream.skip() is not guaranteed to always skip the full amount. you might want to use https://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/IOUtils.html#skipFully(java.io.InputStream,long)
thanks for sharing! that's a nifty little solution to that problem. i'm glad to hear that rmiio is still useful.
RMIIO is a godsend as it lets a Tomcat Server stream a file through a JBoss server. This keeps a tier 1 box away from tier 3. Trouble is, out of the box, it doesn't grant random access, which is unfriendly for playing ninety minute telephone conversations. Fortunately, random access is possible and successfully implemented. In the spirit of contribution, I link to a description of my solution, J2EE - Miscellaneous, Streaming Large Files in n-Tier. Although it mentions Struts 2, it's really J2EE ...
lol, I just found this function now, and thanks for confirming this method, thank you very much, and congratulations the verygood framework, sorry for my english.
you would use a FunctionCall with a single parameter. https://openhms.sourceforge.io/sqlbuilder/apidocs/com/healthmarketscience/sqlbuilder/FunctionCall.html
you would use a FunctionCall with a single string parameter. https://openhms.sourceforge.io/sqlbuilder/apidocs/com/healthmarketscience/sqlbuilder/FunctionCall.html
I would like to know if there is any way to use Sequence, nexvtal('value') for example, or would I have to create a custom method for this?
I would like to know if there is any way to use Sequence in INSERT INTO, nexvtal('value') for example, or would I have to create a custom method for this? I'm waiting, thanks
I'm waiting, thanks
wait;
thanks
ah, got it now, thanks.
the methods on InsertQuery are just helpers for inserts where you will have a number of columns corresponding with a number of values. It just helpfully stores the right number of SqlObject.QUESTION_MARK values for you. for UpdateQuery, you would just pass the SqlObject.QUESTION_MARK in for the value.
Thanks, that seems like a good solution for inserts. what about updates though? InsertQuery has the addPreparedColumns() method, but for the UpdateQuery, I don't see an equivalent. All I see is addSetClause(), which doesn't help in this case.
if you want to use some form of streaming, you would need to be using a prepared statement. you would use InsertQuery to insert prepared columns and then use the PreparedStatement methods to set the parameters using a stream. Alternately, you can use QueryPreparer to track the placeholders and again, you would use the PlaceHolder to assist in passing the stream to the PreparedStatement.
what is the recommended solution for inserting a very large block of text into a CLOB or TEXT field? The InsertQuery object doesn't seem to support streaming. Just passing in a large string seems fine for most cases, but what if the string is very large?
I'm sorry I was parsing a bunch of table creation sql(s) and forgot to strip the comma of of the first argument so I was looking for a column named "sku," instead of "sku" (SMHAM)
dbTable = dbSchema.addTable("'ItemGroup'"); dbColumn = dbTable.addColumn("sku", Types.VARCHAR, null, null); dbColumn.references(null, "'Item'", "sku"); onDeleteMap.put(dbColumn, "ON DELETE CASCADE"); dbColumn = dbTable.addColumn("groupId", Types.INTEGER, null, null); dbColumn.references(null, "'Group'", "id"); onDeleteMap.put(dbColumn, "ON DELETE CASCADE"); dbTable.primaryKey("itemgroup_pri_key", "sku,", "groupId"); this throws the following exception Exception in thread "main" java.lang.NullPointerException...
dbTable = dbSchema.addTable("'ItemGroup'"); dbColumn = dbTable.addColumn("sku", Types.VARCHAR, null, null); dbColumn.references(null, "'Item'", "sku"); onDeleteMap.put(dbColumn, "ON DELETE CASCADE"); dbColumn = dbTable.addColumn("groupId", Types.INTEGER, null, null); dbColumn.references(null, "'Group'", "id"); onDeleteMap.put(dbColumn, "ON DELETE CASCADE"); dbTable.primaryKey("itemgroup_pri_key", "sku,", "groupId"); this throws the following exception Exception in thread "main" java.lang.NullPointerException...
i believe what you are looking for is https://openhms.sourceforge.io/sqlbuilder/apidocs/com/healthmarketscience/sqlbuilder/ForeignKeyConstraintClause.html#setOnDeleteAction-java.lang.Object-
DbTable dbTable = null; DbColumn dbColumn = null; ForeignKeyConstraintClause fkConstraintClause = null; DbForeignKeyConstraint dbForeignKeyConstraint = null; dbTable = dbSchema.addTable("Squid"); dbColumn = dbTable.addColumn("id", Types.INTEGER, null); dbColumn.primaryKey(); dbTable.addColumn("rant", Types.VARCHAR, null); dbTable = dbSchema.addTable("Items"); dbColumn = dbTable.addColumn("sku", Types.VARCHAR, null); dbColumn.primaryKey(); dbColumn = dbTable.addColumn("SquidId", Types.INTEGER, null);...
[maven-release-plugin] prepare for next development iteration
[maven-release-plugin] copy for tag openhms-parent-2.0.7
[maven-release-plugin] prepare release openhms-parent-2.0.7
update plugin version
[maven-release-plugin] prepare for next development iteration
[maven-release-plugin] copy for tag openhms-parent-2.0.6
[maven-release-plugin] prepare release openhms-parent-2.0.6
update ssh
[maven-release-plugin] prepare for next development iteration
[maven-release-plugin] copy for tag openhms-parent-2.0.5
[maven-release-plugin] prepare release openhms-parent-2.0.5
[maven-release-plugin] prepare for next development iteration
[maven-release-plugin] copy for tag openhms-parent-2.0.4
[maven-release-plugin] prepare release openhms-parent-2.0.4
switch to findbugs
thanks, i really appreciate that! glad you are finding the library both useful and enjoyable.
I registered an account on SourceForge to submit this. You have my thanks for open-sourcing and maintaining this library, it's brilliantly designed and of unusually high quality. Your efforts are much appreciated.
those don't currently exist. feel free to file a feature request https://sourceforge.net/p/openhms/feature-requests/ or, better yet, submit a patch https://sourceforge.net/p/openhms/patches/. i would imagine most of those would be pretty simple (although table renaming doesn't seem to have a standard syntax).
link to the unit test source is included in the "Getting Started" section on the main project page.
Hello. I did not find whether it is possible to create the following requests: 1) create schema "schema name" 2) drop schema "schema name" 3) alter table "table name" drop column "column name" 4) alter table "table name" rename to "new table name" If this is not possible now, is it planned?
Hello. I did not find whether it is possible to create the following requests: 1) create schema <schema name=""> 2) drop schema <schema name=""> 3) alter table </schema></schema> drop column rename to <new table="" name=""> If this is not possible now, is it planned?</new>
Thanks for the answer, you need to explicitly indicate the link to the tests on the project page - this will help to find answers to many questions.
Thanks for the answer, you need to explicitly indicate the link to the tests on the project page - this will help to find answers to many questions. Another question - is it possible to make a request with "drop column"?
so the BinaryCondition logic is attempting to interpret the value you passed in. since you have only passed in a String, it is being interpreted as a value. in order to use a column, it is best to use a Column instance, e.g. dbTable.findColumn("id"). note, there are a ton of examples in https://openhms.sourceforge.io/sqlbuilder/xref-test/com/healthmarketscience/sqlbuilder/SqlBuilderTest.html#SqlBuilderTest
Hey! when creating an UpdateQuery or SelectQuery query, for example: String column = "id"; String value = "123"; String query = newSelectQuery() .addFromTable(dbTable) .addAllTableColumns(dbTable) .addCondition(BinaryCondition.equalTo(column, value)) .validate() .toString() the resulting query string looks like this: "SELECT t0. FROM public.test1 t0 WHERE ('id' = '123')" and the problem is that this query does not return a result, because the table column name "id" in the where clause is enclosed...
Hey! when creating an UpdateQuery or SelectQuery query, for example: String column = "id"; String value = "123"; String query = newSelectQuery() .addFromTable(dbTable) .addAllTableColumns(dbTable) .addCondition(BinaryCondition.equalTo(column, value)) .validate() .toString() the resulting query string looks like this: "SELECT t0. FROM public.test1 t0 WHERE ('id' = '123')" and the problem is that this query does not return a result, because the table column name "id" in the where clause is enclosed...
Hey! when creating an UpdateQuery or SelectQuery query, for example: String column = "id"; String value = "123"; String query = newSelectQuery() .addFromTable(dbTable) .addAllTableColumns(dbTable) .addCondition(BinaryCondition.equalTo(column, value)) .validate() .toString() the resulting query string looks like this: "SELECT t0. FROM public.test1 t0 WHERE ('id' = '123')" and the problem is that this query does not return a result, because the table column name "id" in the where clause is enclosed...
can you show an example of what you are attempting?
@jahlborn I tried common table expression for joining a table with subquery but it is not working and getting validation exception, if i am not joining it is working fie. Can you please suggest
[maven-release-plugin] prepare for next development iteration
[maven-release-plugin] copy for tag openhms-parent-2.0.3
[maven-release-plugin] prepare release openhms-parent-2.0.3
update enforcer plugin version
Excellent, thank you! (And, as I should have said up front: thank you for this package!)
update sql syntax types
SqlBuilder 3.0.2 released
[maven-release-plugin] prepare for next development iteration
[maven-release-plugin] copy for tag sqlbuilder-3.0.2
[maven-release-plugin] prepare release sqlbuilder-3.0.2
prep for release
Add optional null-handling argument to addCustomOrdering and similar methods
added some relevant comments in 3.0.2 release.
Add convenience methods for constructing OrderObject instances. Add documention about using OrderObject to control null ordering.
yep, that's a great suggestion. some of the newer features haven't been as thoroughly documented.
Thanks, James, that's really helpful! I was able to get this to what I needed without too much trouble. Perhaps worth adding a note to the documentation?
so i admit that it is not super obvious, but this is already supported. you can see an example in the unit tests here https://openhms.sourceforge.io/sqlbuilder/xref-test/com/healthmarketscience/sqlbuilder/SqlBuilderTest.html#L692
Add optional null-handling argument to addCustomOrdering and similar methods
that's not really a self join, you actually want to use a subquery as a join source. this is not directly supported in sqlbuilder (should really add a FAQ entry for this). however, a "common table expression" is the modern form of this, which is supported in sqlbuilder. see this similar thread for more details. Note, i've created a FAQ entry for this since it's come up a few times before.
Note, i've created a FAQ entry for this.
add faq entry for ctes
add download link
that's not really a self join, you actually want to use a subquery as a join source. this is not directly supported in sqlbuilder (should really add a FAQ entry for this). however, a "common table expression" is the modern form of this, which is supported in sqlbuilder. see this similar thread for more details.
I want to generate a self join query something similar to SQL showed below, I tried several ways but couldn't accomplish it. select time_stamp, metric_name, sum(metric_value) from metrics_table "t0" JOIN ( select metric_name, MAX(time_stamp) as time_stamp from metrics_table GROUP BY metric_name ) as "t1" where t0.metric_name = t1.metric_name and t0.time_stamp = t1.time_stamp Thanks for assistance!!!
I want to generate a self join query something similar to SQL showed below, I tried several ways but couldn't accomplish it. select timestamp, metric_name, sum(metric_value) from metrics_table "t0" INNER JOIN ( select metric_name, MAX(timestamp) as timestamp from metrics_table GROUP BY metric_name ) as "t1" where t0.metric_name = t1.metric_name and t0.timestamp = t1.timestamp Thanks for assistance!!!
the RejoinTable would not be added to the Spec. The Spec is generally intended for the objects which are declared explicitly in the database and would be reused across multiple queries. the RejoinTable is more targeted for use within a single query in which you need to join the same table multiple times. you can see some example usage in the unit tests, where you would manually add the join to the query using the RejoinTable.
Hello, Im stuck at using a RejoinTable. I have created the Rejoin Table, but im not sure how to use it DbSpec spec = new DbSpec(); DbSchema sapWeb = spec.addSchema("sapweb"); String unitSapAlias = "unit"; DbTable unitSap = new DbTable(sapWeb, "unitsap", unitSapAlias); sapWeb.addTable(unitSap); ....//addColumn methods String unitSapRealAlias = "unitReal"; RejoinTable rejoinTable = unitSap.rejoin(unitSapRealAlias); Do I need to do a spec.addJoin. I have made normal addJoins, but exceptions are thrown...