Activity for The OpenHMS Project

  • marcello endo marcello endo posted a comment on discussion SqlBuilder Help

    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.

  • James Ahlborn James Ahlborn modified a comment on discussion SqlBuilder Help

    you would use a FunctionCall with a single parameter. https://openhms.sourceforge.io/sqlbuilder/apidocs/com/healthmarketscience/sqlbuilder/FunctionCall.html

  • James Ahlborn James Ahlborn posted a comment on discussion SqlBuilder Help

    you would use a FunctionCall with a single string parameter. https://openhms.sourceforge.io/sqlbuilder/apidocs/com/healthmarketscience/sqlbuilder/FunctionCall.html

  • marcello endo marcello endo posted a comment on discussion SqlBuilder Help

    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?

  • marcello endo marcello endo modified a comment on discussion SqlBuilder Help

    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

  • marcello endo marcello endo modified a comment on discussion SqlBuilder Help

    I'm waiting, thanks

  • marcello endo marcello endo modified a comment on discussion SqlBuilder Help

    wait;

  • marcello endo marcello endo posted a comment on discussion SqlBuilder Help

    thanks

  • Grant Lee Grant Lee posted a comment on discussion SqlBuilder Help

    ah, got it now, thanks.

  • James Ahlborn James Ahlborn posted a comment on discussion SqlBuilder Help

    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.

  • Grant Lee Grant Lee posted a comment on discussion SqlBuilder Help

    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.

  • James Ahlborn James Ahlborn posted a comment on discussion SqlBuilder Help

    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.

  • Grant Lee Grant Lee posted a comment on discussion SqlBuilder Help

    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?

  • Louis Reinitz Louis Reinitz posted a comment on discussion SqlBuilder Help

    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)

  • Louis Reinitz Louis Reinitz modified a comment on discussion SqlBuilder Help

    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...

  • Louis Reinitz Louis Reinitz posted a comment on discussion SqlBuilder Help

    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...

  • James Ahlborn James Ahlborn posted a comment on discussion SqlBuilder Help

    i believe what you are looking for is https://openhms.sourceforge.io/sqlbuilder/apidocs/com/healthmarketscience/sqlbuilder/ForeignKeyConstraintClause.html#setOnDeleteAction-java.lang.Object-

  • Louis Reinitz Louis Reinitz posted a comment on discussion SqlBuilder Help

    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);...

  • James Ahlborn James Ahlborn committed [r673]

    [maven-release-plugin] prepare for next development iteration

  • James Ahlborn James Ahlborn committed [r672]

    [maven-release-plugin] copy for tag openhms-parent-2.0.7

  • James Ahlborn James Ahlborn committed [r671]

    [maven-release-plugin] prepare release openhms-parent-2.0.7

  • James Ahlborn James Ahlborn committed [r670]

    update plugin version

  • James Ahlborn James Ahlborn committed [r669]

    [maven-release-plugin] prepare for next development iteration

  • James Ahlborn James Ahlborn committed [r668]

    [maven-release-plugin] copy for tag openhms-parent-2.0.6

  • James Ahlborn James Ahlborn committed [r667]

    [maven-release-plugin] prepare release openhms-parent-2.0.6

  • James Ahlborn James Ahlborn committed [r666]

    update ssh

  • James Ahlborn James Ahlborn committed [r665]

    [maven-release-plugin] prepare for next development iteration

  • James Ahlborn James Ahlborn committed [r664]

    [maven-release-plugin] copy for tag openhms-parent-2.0.5

  • James Ahlborn James Ahlborn committed [r663]

    [maven-release-plugin] prepare release openhms-parent-2.0.5

  • James Ahlborn James Ahlborn committed [r662]

    [maven-release-plugin] prepare for next development iteration

  • James Ahlborn James Ahlborn committed [r661]

    [maven-release-plugin] copy for tag openhms-parent-2.0.4

  • James Ahlborn James Ahlborn committed [r660]

    [maven-release-plugin] prepare release openhms-parent-2.0.4

  • James Ahlborn James Ahlborn committed [r659]

    switch to findbugs

  • James Ahlborn James Ahlborn posted a comment on discussion SqlBuilder Help

    thanks, i really appreciate that! glad you are finding the library both useful and enjoyable.

  • Gavin Ray Gavin Ray posted a comment on discussion SqlBuilder Help

    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.

  • James Ahlborn James Ahlborn posted a comment on discussion SqlBuilder Help

    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).

  • James Ahlborn James Ahlborn posted a comment on discussion SqlBuilder Help

    link to the unit test source is included in the "Getting Started" section on the main project page.

  • Denis Denis modified a comment on discussion SqlBuilder Help

    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?

  • Denis Denis posted a comment on discussion SqlBuilder Help

    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>

  • Denis Denis modified a comment on discussion SqlBuilder Help

    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.

  • Denis Denis posted a comment on discussion SqlBuilder Help

    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"?

  • James Ahlborn James Ahlborn posted a comment on discussion SqlBuilder Help

    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

  • Denis Denis modified a comment on discussion SqlBuilder Help

    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...

  • Denis Denis modified a comment on discussion SqlBuilder Help

    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...

  • Denis Denis posted a comment on discussion SqlBuilder Help

    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...

  • James Ahlborn James Ahlborn posted a comment on discussion SqlBuilder Help

    can you show an example of what you are attempting?

  • Raj Raj posted a comment on discussion SqlBuilder Help

    @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

  • James Ahlborn James Ahlborn committed [r658]

    [maven-release-plugin] prepare for next development iteration

  • James Ahlborn James Ahlborn committed [r657]

    [maven-release-plugin] copy for tag openhms-parent-2.0.3

  • James Ahlborn James Ahlborn committed [r656]

    [maven-release-plugin] prepare release openhms-parent-2.0.3

  • James Ahlborn James Ahlborn committed [r655]

    update enforcer plugin version

  • Mike Taylor Mike Taylor posted a comment on ticket #28

    Excellent, thank you! (And, as I should have said up front: thank you for this package!)

  • James Ahlborn James Ahlborn committed [r654]

    update sql syntax types

  • James Ahlborn James Ahlborn created a blog post

    SqlBuilder 3.0.2 released

  • The OpenHMS Project The OpenHMS Project released /sqlbuilder/sqlbuilder-3.0.2/sqlbuilder-3.0.2-sources.jar

  • The OpenHMS Project The OpenHMS Project released /sqlbuilder/sqlbuilder-3.0.2/sqlbuilder-3.0.2-sources.jar

  • The OpenHMS Project The OpenHMS Project released /sqlbuilder/sqlbuilder-3.0.2/sqlbuilder-3.0.2.jar

  • The OpenHMS Project The OpenHMS Project released /sqlbuilder/sqlbuilder-3.0.2/README.txt

  • James Ahlborn James Ahlborn committed [r653]

    [maven-release-plugin] prepare for next development iteration

  • James Ahlborn James Ahlborn committed [r652]

    [maven-release-plugin] copy for tag sqlbuilder-3.0.2

  • James Ahlborn James Ahlborn committed [r651]

    [maven-release-plugin] prepare release sqlbuilder-3.0.2

  • James Ahlborn James Ahlborn committed [r650]

    prep for release

  • James Ahlborn James Ahlborn modified ticket #28

    Add optional null-handling argument to addCustomOrdering and similar methods

  • James Ahlborn James Ahlborn posted a comment on ticket #28

    added some relevant comments in 3.0.2 release.

  • James Ahlborn James Ahlborn committed [r649]

    Add convenience methods for constructing OrderObject instances. Add documention about using OrderObject to control null ordering.

  • James Ahlborn James Ahlborn posted a comment on ticket #28

    yep, that's a great suggestion. some of the newer features haven't been as thoroughly documented.

  • Mike Taylor Mike Taylor posted a comment on ticket #28

    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?

  • James Ahlborn James Ahlborn posted a comment on ticket #28

    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

  • Mike Taylor Mike Taylor created ticket #28

    Add optional null-handling argument to addCustomOrdering and similar methods

  • James Ahlborn James Ahlborn modified a comment on discussion SqlBuilder Help

    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.

  • James Ahlborn James Ahlborn posted a comment on discussion SqlBuilder Help

    Note, i've created a FAQ entry for this.

  • James Ahlborn James Ahlborn committed [r648]

    add faq entry for ctes

  • James Ahlborn James Ahlborn committed [r647]

    add download link

  • James Ahlborn James Ahlborn posted a comment on discussion SqlBuilder Help

    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.

  • Neeraj Shah Neeraj Shah modified a comment on discussion SqlBuilder Help

    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!!!

  • Neeraj Shah Neeraj Shah posted a comment on discussion SqlBuilder Help

    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!!!

  • James Ahlborn James Ahlborn posted a comment on discussion SqlBuilder Help

    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.

  • Fernando Cuervo Hi Fernando Cuervo Hi posted a comment on discussion SqlBuilder Help

    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...

  • James Ahlborn James Ahlborn committed [r646]

    update junit

  • James Ahlborn James Ahlborn committed [r645]

    upgrade junit

  • James Ahlborn James Ahlborn posted a comment on discussion SqlBuilder Help

    i assume you mean a library that is already created? you can certainly do this on your own. in fact, this library was born out of proprietary code which did exactly this. there was an xml model which was parsed into the ddl and dml using this library. however, i don't know of any currently open source implementations of this functionality.

  • Islam OUAHOUDA Islam OUAHOUDA posted a comment on discussion SqlBuilder Help

    Hello, Thanks for the library. I want to ask of there is anyway to build sql queries from XML file with columns data etc.

  • James Ahlborn James Ahlborn posted a comment on discussion SqlBuilder Help

    can you show the code you currently have?

  • Rusiru de silva Rusiru de silva posted a comment on discussion SqlBuilder Help

    I tried to create this query using sqlbuilder, But can't use the arithmetic operators. Any solutions

  • James Ahlborn James Ahlborn committed [r644]

    more minor cleanups

  • James Ahlborn James Ahlborn posted a comment on ticket #25

    https://sourceforge.net/p/openhms/code/HEAD/tree/sqlbuilder/trunk/src/main/java/com/healthmarketscience/sqlbuilder/SqlObjectList.java#l46

  • Riccardo Prandini Riccardo Prandini posted a comment on ticket #25

    ok but the property has to be a lot specific to not mess around with other apps/ packages

  • James Ahlborn James Ahlborn posted a comment on ticket #25

    You can set system properties at runtime. you just need to use System.setProperty() before you start using the sqlbuilder classes (i'd do it in a static{} block in one of your main classes).

  • Riccardo Prandini Riccardo Prandini posted a comment on ticket #25

    When we use the class we have to work with websphere and other application server managed by specific office an the customization via system propery is not an option everywhere. We have a config file and we act at runtime . Thanks

  • James Ahlborn James Ahlborn committed [r643]

    Add system property which allows setting the default list item separator to include a trailing space

  • James Ahlborn James Ahlborn posted a comment on ticket #25

    this isn't the first time i've heard the request for a space after a comma. what if i added a system property to set the default list delimiter to include a trailing space (for all comma separated lists)?

  • Riccardo Prandini Riccardo Prandini posted a comment on ticket #25

    Yes this one is the solution.

  • James Ahlborn James Ahlborn modified a comment on ticket #25

    If you want a custom version of the equivalent functionality, you can create a "CustomFunctionCall" class by copying the FunctionCall class and changing the params initializer to: private SqlObjectList<SqlObject> _params = SqlObjectList.create(", ");

  • James Ahlborn James Ahlborn posted a comment on ticket #25

    If you want a cusom version of the equivalent functionality, you can create a "CustomFunctionCall" class by copying the FunctionCall class and changing the params initializer to: private SqlObjectList<SqlObject> _params = SqlObjectList.create(", ");

  • Riccardo Prandini Riccardo Prandini posted a comment on ticket #25

    Yes this is the second problem i think that with a customizable substring query the things cold be resolved.

  • James Ahlborn James Ahlborn posted a comment on ticket #25

    I'm confused. i thought your original problem is that lack of spaces between the arguments, but the example you are showing does not have spaces. if you don't need the spaces, then everything should work correctly if you do something like: new FunctionCall("SUBSTR").addCustomParams(TBSTSETP_FLGABI,1,1);

  • Riccardo Prandini Riccardo Prandini posted a comment on ticket #25

    I think this is how sql should be done correctly. if you call each table t1...tn also the occurence of each table should report the same tn and not the original one SELECT t13.CDSERVIZ,t13.DSSERVIZ, t8.CDTIPO,t8.DSTIPO FROM ~aliasDb.TBSTANSE t13, ~aliasDb.TBSTTIDP t8, ~aliasDb.TBSTSETP t12 WHERE ( (t8.CDTIPO = t12.TIPPRE) AND (t13.CDSERVIZ = t12.CODSER) AND (t8.CDABI = '05034') AND (t13.CDABI = '05034') AND (t12.CODABI = '05034') AND (t12.DATINI <= CURRENT DATE) AND (t12.FLGABI > CURRENT DATE) AND...

  • James Ahlborn James Ahlborn committed [r642]

    minor code cleanups

1 >