Unable to retrieve parameter values in postgresql dbfit database

113 views
Skip to first unread message

akarun...@mirthcorp.com

unread,
Mar 23, 2017, 3:00:23 AM3/23/17
to dbfit
Hi,

I am not able to use @ symbol to return value from a parameter in postgresql
Also i am not able to able to use <<variable to retrieve value from a vaiable in postgresql

Please help me . value is not getting returned when i run the below query.

In the below query getting null pointer exception.

!path lib/*.jar
!|import fixture|
|dbfit.fixture |

----
'' Connect to Source Database''

!| DatabaseEnvironment | Postgres |
| Connect | 10.20.40.90:5432 | mirthresults | mirthresults | mirthresults |
|set option|bind symbols|true|

!|Query|!-select cast('9999' as integer) as insert_value limit 1-!|
|insert_value?|
|>>abc|

!|Query|!-insert into clinical_item (clinical_item_key) values(@abc)-!|

Yavor Nikolov

unread,
Mar 23, 2017, 4:02:33 AM3/23/17
to dbfit
Hi,

Could you please try with '?' instead of '@'. Also - without a question mark after insert_value:

!|Query|!-select cast('9999' as integer) as insert_value limit 1-!|
|insert_value|
|>>abc|

This message, and any documents attached hereto, may contain confidential or proprietary information intended only for the use of the addressee(s) named above or may contain information that is legally  privileged. If you are not the intended addressee, or the person responsible for delivering it to the intended addressee, you are hereby notified that reading, disseminating, distributing or copying this message is strictly prohibited. If you have received this message by mistake, please immediately notify us by replying to the message and delete the original message and any copies immediately thereafter.  Thank you for your cooperation.

--
You received this message because you are subscribed to the Google Groups "dbfit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dbfit+unsubscribe@googlegroups.com.
To post to this group, send email to db...@googlegroups.com.
Visit this group at https://groups.google.com/group/dbfit.
For more options, visit https://groups.google.com/d/optout.

Yavor Nikolov

unread,
Mar 23, 2017, 4:13:05 AM3/23/17
to dbfit

Yavor Nikolov

unread,
Mar 23, 2017, 4:13:37 AM3/23/17
to dbfit

akarun...@mirthcorp.com

unread,
May 11, 2017, 4:22:00 AM5/11/17
to dbfit
Hi Yavor Nikolov,

Much Thanks!! for your updates. 

I am trying to use this variable >>clinical_item_key as a global variable. For doing which i am trying to create test suite with >>clinical_item_key as mentioned below and then call that variable in concurrent test pages with _:clinical_item_key. 
Please suggest me idea on how to create it. Is it possible to create a suite set up page as below,

!|Import|
|fitnesse.fixtures|

!|SetUp|

And then call the variable _:clinical_item_key in the test pages.

I am using something like below,

I create a suite page (localhost:8085/FixtureWorkSuite) as below,

!path lib/*.jar

!|import fixture |
| dbfit.fixture |

'' Connect to Target Database''

!| DatabaseEnvironment | Postgres |
| Connect | 10.20.40.214:15432 | mirthanalytics| mirthanalytics| mirthanalytics|


!|Query|Select * from stg_allergy limit 1|
|clinical_item_key?|
|>>clinical_item_key_a|



I create a test page (localhost:8085/FixtureWorkSuite.FixtureWorkTest)associate with this suite page like below,

!path lib/*.jar

!|import fixture |
| dbfit.fixture |

''' Connect to Source Database'''

!| DatabaseEnvironment | Postgres |
| Connect | 10.20.40.90:5432 | mirthresults | mirthresults | mirthresults |

|Query|select * from allergy where clinical_item_key in (_:clinical_item_key_a)|
|clinical_item_key|severity_code_key?|
|<<clinical_item_key_a|>>severity_code_key|

|Query|select * from allergy where clinical_item_key in (_:clinical_item_key_a)|
|clinical_item_key|severity_code_key|
|<<clinical_item_key_a|<<severity_code_key|

In the above suite page i am defining the value for clinical_item_key_a and in the test page i am using the value by returning the value to where condtion.

But when i run the suite the suite runs without error but the associate test page throws the below error message,

Query
java.lang.RuntimeException: Symbol 'clinical_item_key_a' does not exist at dbfit.util.SymbolUtil.validateSymbolExists(SymbolUtil.java:71) at dbfit.util.SymbolUtil.getSymbol(SymbolUtil.java:19) at dbfit.util.FitNesseTestHost.getSymbolValue(FitNesseTestHost.java:20) at dbfit.api.AbstractDbEnvironment.createStatementWithBoundFixtureSymbols(AbstractDbEnvironment.java:114) at dbfit.fixture.Query.getDataTable(Query.java:43) at dbfit.fixture.RowSetFixture.doRows(RowSetFixture.java:87) at fit.Fixture.doTable(Fixture.java:154) at fit.Fixture.interpretFollowingTables(Fixture.java:120) at fit.Fixture.interpretTables(Fixture.java:106) at fit.Fixture.doTables(Fixture.java:80) at fit.FitServer.process(FitServer.java:81) at fit.FitServer.run(FitServer.java:56) at fit.FitServer.main(FitServer.java:41)

Please help me to know where i am going wrong. Thanks!

Regards,
Arun Karunakaran
To unsubscribe from this group and stop receiving emails from it, send an email to dbfit+un...@googlegroups.com.

EJ

unread,
May 24, 2017, 5:44:07 PM5/24/17
to dbfit
Hi all,

I am also not able to use a query with a parameter in it while using PostgreSQL.
I tried :var and @var and some other things, but still no succes.

Does anyone know how to do this kind of thing in PostgreSQL:

!|Query|Select count(*) as c from tableX where columnY = :var|
|c?|
|1|

kind regards,
   EJ.

Yavor Nikolov

unread,
May 24, 2017, 5:50:39 PM5/24/17
to dbfit
EJ, you're missing the underscore. Try with:

!|Query|Select count(*) as c from tableX where columnY = _:var|
|c?|
|1|

--
You received this message because you are subscribed to the Google Groups "dbfit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dbfit+unsubscribe@googlegroups.com.

Yavor Nikolov

unread,
May 24, 2017, 6:01:22 PM5/24/17
to dbfit
Hi Arun,

Sorry for the late reply!

FitNesse has a special type of pages called "SetUp". You may take a look e.g. here and in FitNesse docs

FixtureWorkSuite - your suite
FixtureWorkSuite.SetUp - the setup page
FixtureWorkSuite.FixtureWorkTest1
FixtureWorkSuite.FixtureWorkTest2

This way FixtureWorkTest1 and FixtureWorkTest2 will automatically include the SetUp page (that's also visible from the FitNesse UI).

To unsubscribe from this group and stop receiving emails from it, send an email to dbfit+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages