JavaM API for GT.M - SELECT support - select

I'm wondering if there's any possible way how to use or implement SELECT query into JavaM API for GT.M database system. I'm using version 0.1, since I haven't found any other version ( https://github.com/Gadreel/javam/blob/master/README.md ).
If there's no option yet, could you recommend me any other API for this DBMS, using Java? I know there's some gtm4j ( http://code.vistaehr.com/gtm4j ), but it takes advantage of springframework, which is not convenient for me.
I'm new with GT.M and I just want to test, how to connect to it using Java and use some basic queries. Thanks a lot for your advices.

The database side of GT.M is a hierarchical key-value store, so features like SELECT (I'm guessing you want a full SQL SELECT) needs to be implemented by some framework (either an existing framework or one created by you).
From a quick look at the JavaM API, it seems it only offers/showcase a Java interface to the features offered by GT.M. So I think you would have to implement the SQL SELECT feature yourself, in Java.
That said, it is possible that what you wanted to use a SQL SELECT for can be done easilly using the standard GT.M / JavaM API, so there would be no need to implement a full SQL SELECT.

Actually, you could use M to write a parser for your SELECT command syntax. And would certainly be easier to do with the GTMJI plug-in for full-duplex GT.M/Java communication that FIS have just released.

Related

Customise generated Slick SQL for debugging

I want to customise the SQL that Slick generates for a standard insert before it is sent to the DBMS, so that I can add extra DBMS-specific debugging options that Slick doesn't natively support. How can I do that?
At the action level (i.e., with a DBIO), you can replace the SQL Slick will use via overrideStatements. Combined with statements to access the SQL Slick generates, that would give you a place to jump in and customize the SQL.
Bare in mind, you'll be working with Strings with these two API calls.
A simple example would be:
val regularInsert = table += row
// Switching the generated SQL to all-caps is a terrible idea,
// and may not run in your database, but it will do as an example:
val modifiedSQL = regularInsert.statements.map(_.toUpperCase())
val modifiedInsert = regularInsert.overrideStatements(modifiedSQL)
// run modifiedInsert action as normal
The next step up from this would be to implement a custom database profile to override the way inserts are created to include debugging.
This is more involved: you'd want to extend the profile you're currently using, and dive into the Slick APIs to override various methods to change the insert behaviour. For example, you might start by exploring the existing Postgres profile if that's the database you're using.
However, the above example can be applied per-insert as needed which may be enough for what you need.
If you are using a connection pool such as HikariCP, you can put a Java breakpoint on the ProxyConnection.prepareStatement(String sql) method, or the equivalent method in whatever connection pool library you are using. Then when the SQL of interest is about to be prepared by that method, use your debugger's "evaluate expression" functionality to modify/replace the value of sql.
This won't work if the library you are setting the breakpoint on is not open source, or for some other reason is compiled without debugging information.

Remove employee who left from scheduled reports

I need to find all reports that have a schedule with a specific recipient on it, then remove that person. How can I do this programmatically, rather than manually doing it 300+ times.
How can we search schedules by email recipient? Apart from asking the person to forward us the reports so we can try and figure out which ones they are.
Alas, there's no easy way to do this.
To find the list of schedules, you can use the QueryBuilder (available through http[s]://[your BOBJ server]/AdminTools). This web application allows you to query the CMS repository database with limited, SQL-like queries (e.g. no joins, …).
For example, the following query will give you all scheduled (si_schedule_status = 9) publications (si_kind = 'publication'):
select *
from ci_infoobjects
where si_schedule_status = 9
and si_kind = 'publication'
Here's what the result could look like (the output is a formatted HTML with nested structures represented as nested tables):
Alternatively, you could use a free tool such as CMS Query Builder by biclever which is a little easier to use and offers export to Excel functionality.
I would recommend that you start with one object (schedule) which contains the data you need, then look at the fields that contain said data and try to construct a query that way. It's important to know that you cannot query nested data, so you won't be able to extract just the schedules where the given e-mail address appears (as it'll be a few levels down).
If you have sufficient programming experience, and depending on the version of BusinessObjects you're using, you could resort to the Java or REST SDK, although I'm not sure if all the necessary functionality is available in the latter.
With both SDKs, your starting point will again be a CMS query to retrieve the desired objects before modifying them. The documentation for the SDKs is available through the SAP Help Portal; look for the Development section. You'll need to look at the Business Intelligence Platform Java SDK Developer Guide and SAP Business Intelligence Platform Java API Reference.

PostgreSQL V9.4 - Logical Decoding - SQL interface: Starting at a specific LSN?

I use PostgreSQL Logical Decoding functionality for retrieving WAL contents:
SELECT * FROM pg_create_logical_replication_slot(...)
SELECT * FROM pg_logical_slot_get_changes('<my_slot>', NULL, NULL);
These calls are implemented in the SQL interface within a "C" / ODBC
programming framework.
This works very nice for me.
Data records are fetched one by one in a row - as expected.
Yet - there are certain cases where I need to re-position the slot flow
to a past LSN.
The Logical Decoding REPLICATION interface provides means for achieving that.
For example the PG_RECVLOGICAL program introduces a "--startpos=X/Y" option
that works as I expect.
Is there an equivalent option in the "SQL" interface?
I guess that both interfaces share much in common.
So - I went through the documentation and did not manage to find any equivalent
option in the SQL interface.
For now - the SQL interface moves forward only and cannot retract back to a
past LSN.
Did I miss something here?
Does any body have any clue or experience with that?
Kindest regards
Hillel.
According to the replication SQL function docs it doesn't look possible :-(
http://www.postgresql.org/docs/9.4/static/functions-admin.html#FUNCTIONS-REPLICATION

Can I notify and listen inside PostgreSQL procedures (functions)?

I have checked the documentation (for my version 9.3):
http://www.postgresql.org/docs/9.3/static/sql-notify.html
http://www.postgresql.org/docs/9.3/static/sql-listen.html
I have read multiple discussions and blogs about notify-listen in postgres.
They all use a listening process / interface, which is not implemented inside "classic" procedure (which is function in postgres anyway). They implement it in different language and/or environment, external to the postgres server (e.g. perl, C#).
My question: Is it possible to implement listen(ing) inside postgres function (language plpgsql) ? If not (what I assume from not being to able to find such topic / example), can someone explain a bit, why it can't be done, or maybe why it does not make sense to do it that way ?
It is a classic use case for Trigger Function in case you depend on a single table: https://www.postgresql.org/docs/current/plpgsql-trigger.html

What is the Best Test Automation Approach for WatiN

I Studied both data-driven and keyword driven approaches. After reading, It seems data driven is better than keyword. For documentation purpose keyword sounds great. But it has many levels. I need guidance from people who actually have implemented Automation frameworks. Personally, I want to store all data in database or excel and break up the system into modular parts (functions that are common to major company products).
Currently using, WatiN, Nunit, CC.net
Any advise pls
I would hightly recommend that you look into the stack that Michael Hunter aka the braidy tester built for testing expression at Microsoft he has a lot of articles about it http://www.thebraidytester.com/stack.html
Esentially he splits out into a logical model, a physical model and a data model and all three are loosley copupled. All my stacks are written this way now. So the test cases end up looking like this:
Logical.Google.Search.Websearch("watin");
Verification.VerifySearchResult("watin");
All the test data is then stored in a sql express database that indexed by the text string, in this case watin.
You will need to build a full domain model and data access layer, I personally auto generate that using SubSonic.