Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8D50A200BCA for ; Mon, 21 Nov 2016 15:20:08 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 8C008160AF9; Mon, 21 Nov 2016 14:20:08 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D715F160AEC for ; Mon, 21 Nov 2016 15:20:07 +0100 (CET) Received: (qmail 78512 invoked by uid 500); 21 Nov 2016 14:20:07 -0000 Mailing-List: contact dev-help@edgent.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@edgent.apache.org Delivered-To: mailing list dev@edgent.apache.org Received: (qmail 78497 invoked by uid 99); 21 Nov 2016 14:20:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Nov 2016 14:20:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 8940DC0F8E for ; Mon, 21 Nov 2016 14:20:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id HtPRqFt7c0lo for ; Mon, 21 Nov 2016 14:20:05 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id F22EA5FD0E for ; Mon, 21 Nov 2016 14:19:59 +0000 (UTC) Received: (qmail 77456 invoked by uid 99); 21 Nov 2016 14:19:59 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Nov 2016 14:19:59 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id E89722C4C82 for ; Mon, 21 Nov 2016 14:19:58 +0000 (UTC) Date: Mon, 21 Nov 2016 14:19:58 +0000 (UTC) From: "Dale LaBossiere (JIRA)" To: dev@edgent.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (EDGENT-311) support SELECT without any parameters in JdbcStreams MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 21 Nov 2016 14:20:08 -0000 [ https://issues.apache.org/jira/browse/EDGENT-311?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15683675#comment-15683675 ] Dale LaBossiere commented on EDGENT-311: ---------------------------------------- Ah. The basic model the connector's API presents is "Each tuple on the input streams triggers the execution of the prepared statement, generating 0 or more tuples on the result stream. It's very general. The tuple's contents may or may not supply values for statement parameters. The tuple many or may not be present in the result stream -- e.g., enrichment vs simple query results." Interpreting the input tuple only as "the parameters of the prepared statement" is a bit too constraining. And it's not correct to think of the ParameterSetter as returning anything or triggering statement execution - the setter is just called to set any parameters in the prepared statement it's given. Viewed in this light, does the API make more sense to you? Do you image this "one-time statement execution" case you've described to be a common one? Maybe you could elaborate on the use case, give some more context, so as to make an argument for why the API should be augmented in order to simplify implementing this use case. > support SELECT without any parameters in JdbcStreams > ---------------------------------------------------- > > Key: EDGENT-311 > URL: https://issues.apache.org/jira/browse/EDGENT-311 > Project: Edgent > Issue Type: Improvement > Components: Connectors > Affects Versions: Apache Edgent 1.0.0 > Reporter: Rui Shen > Priority: Minor > > Now I am trying to run a SELECT statement without parameters (e.g "select id,name,age from person") using JdbcStreams. But I found there is no straightforward way to do this. Looks like the APIs of JdbcStreams is designed for only prepared statement with parameters . > However, I found a workaround to make this - always create a TStream with one tuple but in the ParameterSetter, does nothing. Although this works, it looks uncomfortable. Are you going to support this in the future release? > > Topology t = this.newTopology("testSelect_WithParameters"); > JdbcStreams db=new JdbcStreams(ds,(ds)=> > {ds.getConnection()} > ); > TStream stream=t.collection(Arrays.asList(new String[] > {"dummy"} > )); // to execute the sql, always needs to create a TStream containing one tuple. > ParameterSetter paramSetter=(s,stmt)->{}; //do nothing here > ResultsHandler rh = (tuple, rs, exc, consumer) -> {}; > db.executeStatement(stream, "select id,name,age from person", paramSetter,rh); > -- This message was sent by Atlassian JIRA (v6.3.4#6332)