<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Ruby API returns different result based on same SQL but prepared vs execute_direct in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/ruby-api-returns-different-result-based-on-same-sql-but-prepared-vs-execute/qaa-p/13704500#M4829720</link>
    <description>I made an "Answer" below - seems I cant directly reply to you</description>
    <pubDate>Fri, 17 May 2024 08:29:11 GMT</pubDate>
    <dc:creator>kbachl</dc:creator>
    <dc:date>2024-05-17T08:29:11Z</dc:date>
    <item>
      <title>Ruby API returns different result based on same SQL but prepared vs execute_direct</title>
      <link>https://community.sap.com/t5/technology-q-a/ruby-api-returns-different-result-based-on-same-sql-but-prepared-vs-execute/qaq-p/13696151</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt; sql = &amp;lt;&amp;lt;-END_SQL
            select count("ItemCode") from "TEST2024"."OITM" where "ItemCode" =  ?
        END_SQL
        p item_code

        # this won't work, allways returns [0,0]!
        stmt = @@api.hanaclient_prepare @@connection, sql
        _, param = @@api.hanaclient_describe_bind_param(stmt, 0)
        param.set_value(item_code)
        @@api.hanaclient_bind_param(stmt, 0, param)
        _rc = @@api.hanaclient_execute(stmt)
        @@api.hanaclient_fetch_next( stmt )


        puts "R1: " + @@api.hanaclient_get_column(stmt, 0).to_s
        @@api.hanaclient_free_stmt(stmt)


        #This works -&amp;gt; correct results returned:
        sql = ActiveRecord::Base.sanitize_sql([sql, item_code])
        stmt = @@api.hanaclient_execute_direct(@@connection, sql)
        @@api.hanaclient_fetch_next( stmt )
        puts "R2: " +  @@api.hanaclient_get_column(stmt, 0).to_s&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;whatever I try I allways get a return of array [0,0] in case of my prepared statement compared to the direct executed one that returns the correct and expected data.&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;LI-CODE lang="bash"&gt;11:38:27 web.1             | "CODE-1"
11:38:27 web.1             | R1: [1, 0]
11:38:27 web.1             | R2: [1, 1]
11:38:27 web.1             | nil
11:38:27 web.1             | "CODE-2"
11:38:27 web.1             | R1: [1, 0]
11:38:27 web.1             | R2: [1, 1]
11:38:27 web.1             | nil
11:38:27 web.1             | "NOTEXISITNG"
11:38:27 web.1             | R1: [1, 0]
11:38:27 web.1             | R2: [1, 0]
11:38:27 web.1             | nil&lt;/LI-CODE&gt;&lt;P&gt;Im using the latest driver 20.20.20. Any idea what I made wrong in my prepared statement?&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 09:43:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/ruby-api-returns-different-result-based-on-same-sql-but-prepared-vs-execute/qaq-p/13696151</guid>
      <dc:creator>kbachl</dc:creator>
      <dc:date>2024-05-09T09:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Ruby API returns different result based on same SQL but prepared vs execute_direct</title>
      <link>https://community.sap.com/t5/technology-q-a/ruby-api-returns-different-result-based-on-same-sql-but-prepared-vs-execute/qaa-p/13703925#M4829630</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I can't seem to reproduce this behaviour with a simplified example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;require 'hanaclient'
include HANACLIENT

@@api = HANACLIENT::HANACLIENTInterface.new()
HANACLIENT::API.hanaclient_initialize_interface(@@api)
@@api.hanaclient_init()
@@conn = @@api.hanaclient_new_connection()
@@api.hanaclient_connect(@@conn, "servernode=myserver:30015;UID=myuser;PWD=mypwd")

sql = &amp;lt;&amp;lt;-END_SQL
            select 42 from "SYS"."DUMMY" where 1 = ?
        END_SQL
item_code = 1

stmt = @@api.hanaclient_prepare @@conn, sql
_, param = @@api.hanaclient_describe_bind_param(stmt, 0)
param.set_value(item_code)
@@api.hanaclient_bind_param(stmt, 0, param)
_rc = @@api.hanaclient_execute(stmt)
@@api.hanaclient_fetch_next( stmt )

puts "R1: " + @@api.hanaclient_get_column(stmt, 0).to_s
@@api.hanaclient_free_stmt(stmt)

@@api.hanaclient_disconnect(@@conn)
@@api.hanaclient_free_connection(@@conn)
@@api.hanaclient_fini()
HANACLIENT::API.hanaclient_finalize_interface(@@api)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you also run my example and see the correct value?&lt;BR /&gt;&lt;BR /&gt;From your example, are you sure that the value being bound is being found correctly in the table? Have you tried adding &lt;A href="https://help.sap.com/docs/SAP_HANA_CLIENT/f1b440ded6144a54ada97ff95dac7adf/57e04b844d9f40d0bd5ca90f72629255.html?locale=en-US" target="_self"&gt;SQLDBC Tracing&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;to your application to better understand what's happening inside the driver for the bind value and result? You can quickly set environment variables to trace to stdout if that's helpful:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="bash"&gt;export HDB_SQLDBC_TRACEFILE=stdout
export HDB_SQLDBC_TRACEOPTS=SQL,DEBUG,FLUSH&lt;/LI-CODE&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 18:25:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/ruby-api-returns-different-result-based-on-same-sql-but-prepared-vs-execute/qaa-p/13703925#M4829630</guid>
      <dc:creator>jeff_albion</dc:creator>
      <dc:date>2024-05-16T18:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: Ruby API returns different result based on same SQL b...</title>
      <link>https://community.sap.com/t5/technology-q-a/ruby-api-returns-different-result-based-on-same-sql-but-prepared-vs-execute/qaa-p/13704499#M4829719</link>
      <description>&lt;P&gt;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/209056"&gt;@jeff_albion&lt;/a&gt;Thanks for trying to help.&lt;/P&gt;&lt;P&gt;I tried your example and it worked as long as the type was integer. As soon as I changed the SQL to use would use String it broke, see:&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;...
    sql = &amp;lt;&amp;lt;-END_SQL
            select 42 from "SYS"."DUMMY" where 'TestValue' = ?
        END_SQL
          item_code = 'TestValue'

          stmt = @@api.hanaclient_prepare @@connection, sql
          _, param = @@api.hanaclient_describe_bind_param(stmt, 0)
          param.set_value(item_code)
          @@api.hanaclient_bind_param(stmt, 0, param)
          _rc = @@api.hanaclient_execute(stmt)
          @@api.hanaclient_fetch_next( stmt )

          puts "R1: " + @@api.hanaclient_get_column(stmt, 0).to_s
          @@api.hanaclient_free_stmt(stmt)
...&lt;/LI-CODE&gt;&lt;P&gt;Here it still should work as 'TestValue' = 'TestValue' would be true, yet it gets not result back:&lt;/P&gt;&lt;LI-CODE lang="bash"&gt;10:13:01 web.1             | [SQLDBC] SQL COMMAND :             select 42 from "SYS"."DUMMY" where 'TestValue' = ?
10:13:01 web.1             | 
10:13:01 web.1             | [SQLDBC] ENCODING    : UTF8
10:13:01 web.1             | [SQLDBC] &amp;gt;Connection::getClientInfo (2024-05-17 10:13:01.192786)
10:13:01 web.1             | [SQLDBC] &amp;lt;=0x00007e6270061cb8
10:13:01 web.1             | [SQLDBC] &amp;gt;PreparedStatement::resetParametersProcessed (2024-05-17 10:13:01.192788)
10:13:01 web.1             | [SQLDBC] &amp;lt;
10:13:01 web.1             | [SQLDBC] &amp;gt;ParseInfo::selectPhysicalConnection (2024-05-17 10:13:01.192791)
10:13:01 web.1             | [SQLDBC] &amp;gt;Connection::selectPhysicalConnection (2024-05-17 10:13:01.192795)
10:13:01 web.1             | [SQLDBC] locationIndex=4294967295
10:13:01 web.1             | [SQLDBC] isUpdateCommand=0
10:13:01 web.1             | [SQLDBC] &amp;gt;Connection::getPrimaryConnection (2024-05-17 10:13:01.192798)
10:13:01 web.1             | [SQLDBC] &amp;lt;=1
10:13:01 web.1             | [SQLDBC] &amp;lt;=1
10:13:01 web.1             | [SQLDBC] &amp;lt;=1
10:13:01 web.1             | [SQLDBC] &amp;gt;PreparedStatement::resetResults (2024-05-17 10:13:01.192803)
10:13:01 web.1             | [SQLDBC] &amp;gt;Statement::resetResults (2024-05-17 10:13:01.192804)
10:13:01 web.1             | [SQLDBC] clearResultSet=1
10:13:01 web.1             | [SQLDBC] &amp;gt;Connection::getWorkloadReplayContext (2024-05-17 10:13:01.192807)
10:13:01 web.1             | [SQLDBC] m_workloadReplayContext=
10:13:01 web.1             | [SQLDBC] &amp;lt;
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] STATEMENTID    : STATEMENT[C22CE9B2325B0500(1507648191671490):1]
10:13:01 web.1             | [SQLDBC] INPUT PARAMETERS
10:13:01 web.1             | [SQLDBC] APPLICATION
10:13:01 web.1             | [SQLDBC] INDEX TYPE       AT LENGTH        INDICATOR     DATA
10:13:01 web.1             | [SQLDBC] &amp;gt;PreparedStatement::checkInitParameters (2024-05-17 10:13:01.192815)
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;gt;Connection::getRequestPacket (2024-05-17 10:13:01.192818)
10:13:01 web.1             | [SQLDBC] packetsize=0
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;gt;RequestPacket::addSegment (2024-05-17 10:13:01.192821)
10:13:01 web.1             | [SQLDBC] &amp;lt;
10:13:01 web.1             | [SQLDBC] &amp;gt;RoutingInfo::addRoutingInfoPart (2024-05-17 10:13:01.192829)
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;gt;PreparedStatement::executeFillDirectData (2024-05-17 10:13:01.192833)
10:13:01 web.1             | [SQLDBC] haslobs=0
10:13:01 web.1             | [SQLDBC] startindex=1
10:13:01 web.1             | [SQLDBC] &amp;gt;Translator::translateInput (2024-05-17 10:13:01.192836)
10:13:01 web.1             | [SQLDBC] arrayoffset=0
10:13:01 web.1             | [SQLDBC] rowsize=0
10:13:01 web.1             | [SQLDBC] &amp;gt;StringTranslator::translateUTF8Input (2024-05-17 10:13:01.192845)
10:13:01 web.1             | [SQLDBC] data=
10:13:01 web.1             | [SQLDBC] &amp;gt;GenericTranslator::addCharacterData (2024-05-17 10:13:01.192855)
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] 1     UTF8          0             0             ''
10:13:01 web.1             | [SQLDBC] 
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;gt;Connection::sqlaexecute_clientconnection (2024-05-17 10:13:01.192873)
10:13:01 web.1             | [SQLDBC] &amp;gt;Connection::updateStatementContextInRequest (2024-05-17 10:13:01.192875)
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC]   PHYSICAL CONNECTION - [0x00007e62700654c0]  [CONNECTED - COORDINATOR]
10:13:01 web.1             | [SQLDBC]   CONNECTED AT        : 2024-05-17 10:13:01.009213
10:13:01 web.1             | [SQLDBC]   LOCATION            : 192.168.*.*:30015 [192.168.*.*]
10:13:01 web.1             | [SQLDBC]   SERVER CONNECTION ID: 351026
10:13:01 web.1             | [SQLDBC]   CLIENT CONNECTION ID: 1
10:13:01 web.1             | [SQLDBC]   VOLUME ID           : 3
10:13:01 web.1             | [SQLDBC]   SESSION ID          : 1647312013039303
10:13:01 web.1             | [SQLDBC]   LAST SEND TIME      : 2024-05-17 10:13:01.141457
10:13:01 web.1             | [SQLDBC]   LAST RECEIVE TIME   : 2024-05-17 10:13:01.192421
10:13:01 web.1             | [SQLDBC] CONNECTION OBJECT : [0x00007e6270061950]
10:13:01 web.1             | [SQLDBC] &amp;gt;SimpleClientSocket::doPollBeforeSendToDetectSocketDead (2024-05-17 10:13:01.192891)
10:13:01 web.1             | [SQLDBC] &amp;lt;
10:13:01 web.1             | [SQLDBC] SEND TIME: 151 USEC, MESSAGE: EXECUTE
10:13:01 web.1             | [SQLDBC] &amp;gt;SocketCommunication::receive (2024-05-17 10:13:01.193060)
10:13:01 web.1             | [SQLDBC] &amp;lt;
10:13:01 web.1             | [SQLDBC] RECV TIME: 48413 USEC
10:13:01 web.1             | [SQLDBC] &amp;gt;Connection::doProcessReply (2024-05-17 10:13:01.241524)
10:13:01 web.1             | [SQLDBC] &amp;gt;ReplySegment::getSQLDiag (2024-05-17 10:13:01.241528)
10:13:01 web.1             | [SQLDBC] &amp;lt;=false
10:13:01 web.1             | [SQLDBC] &amp;gt;Connection::updateTopology (2024-05-17 10:13:01.241532)
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;gt;Connection::updateSessionVariableCache (2024-05-17 10:13:01.241535)
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;gt;Connection::processImplicitXASession (2024-05-17 10:13:01.241540)
10:13:01 web.1             | [SQLDBC] requestMessageType=EXECUTE
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;gt;Connection::updateTransactionStatus (2024-05-17 10:13:01.241544)
10:13:01 web.1             | [SQLDBC] connectionId=1
10:13:01 web.1             | [SQLDBC] action=TA_READTRANS
10:13:01 web.1             | [SQLDBC] TRANSACTION ACTION TA_READTRANS
10:13:01 web.1             | [SQLDBC] TRANSACTION:
10:13:01 web.1             | [SQLDBC]   STATE: READ TRANSACTION
10:13:01 web.1             | [SQLDBC]   PRIMARY: 1
10:13:01 web.1             | [SQLDBC]   TRANSACTION MEMBERS (READ): [1]
10:13:01 web.1             | [SQLDBC]   TRANSACTION MEMBERS (WRITE): []
10:13:01 web.1             | [SQLDBC]   TRANSACTION MEMBERS (WRITE CANDIDATE): []
10:13:01 web.1             | [SQLDBC]   TRANSACTION MEMBERS (WRITE TXN AS OF LAST REPLY) : []
10:13:01 web.1             | [SQLDBC]   HINT ROUTED CONNECTIONS: []
10:13:01 web.1             | [SQLDBC] TRANSACTION UPDATED:
10:13:01 web.1             | [SQLDBC] TRANSACTION:
10:13:01 web.1             | [SQLDBC]   STATE: READ TRANSACTION
10:13:01 web.1             | [SQLDBC]   PRIMARY: 1
10:13:01 web.1             | [SQLDBC]   TRANSACTION MEMBERS (READ): [1]
10:13:01 web.1             | [SQLDBC]   TRANSACTION MEMBERS (WRITE): []
10:13:01 web.1             | [SQLDBC]   TRANSACTION MEMBERS (WRITE CANDIDATE): []
10:13:01 web.1             | [SQLDBC]   TRANSACTION MEMBERS (WRITE TXN AS OF LAST REPLY) : []
10:13:01 web.1             | [SQLDBC]   HINT ROUTED CONNECTIONS: []
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;gt;Connection::updateStatementContextFromReply (2024-05-17 10:13:01.241559)
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] SERVER STATISTICS UPDATE OF [0x00007e627006a3a0]
10:13:01 web.1             | [SQLDBC]   PROCESSING TIME INCREASED TO 170 BY 170 USEC
10:13:01 web.1             | [SQLDBC]   CPU TIME INCREASED TO 99 BY 99 USEC
10:13:01 web.1             | [SQLDBC]   PEAK MEMORY USAGE INCREASED TO 0 BY 0 BYTES
10:13:01 web.1             | [SQLDBC] &amp;gt;Statement::parseResult (2024-05-17 10:13:01.241573)
10:13:01 web.1             | [SQLDBC] &amp;gt;Connection::getWorkloadReplayContext (2024-05-17 10:13:01.241575)
10:13:01 web.1             | [SQLDBC] m_workloadReplayContext=
10:13:01 web.1             | [SQLDBC] &amp;lt;
10:13:01 web.1             | [SQLDBC] RESULTSET ID:RESULT[C22CE9B2325B0500:1]
10:13:01 web.1             | [SQLDBC] parseResult parsing ResultSet
10:13:01 web.1             | [SQLDBC] *** ROW NOT FOUND ***&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So we end up in a SegFault if I try to access a non existing Row that should be here:&lt;/P&gt;&lt;LI-CODE lang="bash"&gt;10:13:01 web.1             | [SQLDBC] ::FETCH NEXT SQLCURS_1 RESULT[C22CE9B2325B0500:1] [0x00007e627006bbb0] 2024-05-17 10:13:01.241744
10:13:01 web.1             | [SQLDBC] &amp;gt;ResultSet::assertNotClosed (2024-05-17 10:13:01.241745)
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;gt;ResultSet::executeFetchNext (2024-05-17 10:13:01.241747)
10:13:01 web.1             | [SQLDBC] &amp;gt;ResultSet::assertValid (2024-05-17 10:13:01.241748)
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_NO_DATA_FOUND
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_NO_DATA_FOUND
10:13:01 web.1             | [SQLDBC] &amp;gt;ResultSet::getResultCount (2024-05-17 10:13:01.241751)
10:13:01 web.1             | [SQLDBC] 
10:13:01 web.1             | [SQLDBC] ::GET RESULT COUNT SQLCURS_1 RESULT[C22CE9B2325B0500:1] [0x00007e627006bbb0]
10:13:01 web.1             | [SQLDBC] COUNT:0
10:13:01 web.1             | [SQLDBC] &amp;gt;ResultSet::assertValid (2024-05-17 10:13:01.241753)
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;lt;=0
10:13:01 web.1             | [SQLDBC] &amp;gt;ConnectionItem::applicationCheckWarnings (2024-05-17 10:13:01.241756)
10:13:01 web.1             | [SQLDBC] ::APPLICATION CHECKING WARNINGS ON CONNECTIONITEM [0x00007e627006bbb0]
10:13:01 web.1             | [SQLDBC] m_diag.warns=
10:13:01 web.1             | [SQLDBC] &amp;lt;
10:13:01 web.1             | [SQLDBC] &amp;gt;ConnectionItem::applicationCheckError (2024-05-17 10:13:01.241761)
10:13:01 web.1             | [SQLDBC] ::APPLICATION CHECKING ERROR ON CONNECTIONITEM [0x00007e627006bbb0]
10:13:01 web.1             | [SQLDBC] m_diag.errs=
10:13:01 web.1             | [SQLDBC] &amp;lt;
10:13:01 web.1             | /...REDACTED.../hana/hana_query.rb:100: [BUG] Segmentation fault at 0x0000000000000010
10:13:01 web.1             | ruby 3.3.1 (2024-04-23 revision c56cd86388) [x86_64-linux]&lt;/LI-CODE&gt;&lt;P&gt;And its libSQLDBCHDB 2.20.20.1712178305&amp;nbsp; version exactly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 08:28:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/ruby-api-returns-different-result-based-on-same-sql-but-prepared-vs-execute/qaa-p/13704499#M4829719</guid>
      <dc:creator>kbachl</dc:creator>
      <dc:date>2024-05-17T08:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: Ruby API returns different result based on same SQL but prepared vs execute_direct</title>
      <link>https://community.sap.com/t5/technology-q-a/ruby-api-returns-different-result-based-on-same-sql-but-prepared-vs-execute/qaa-p/13704500#M4829720</link>
      <description>I made an "Answer" below - seems I cant directly reply to you</description>
      <pubDate>Fri, 17 May 2024 08:29:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/ruby-api-returns-different-result-based-on-same-sql-but-prepared-vs-execute/qaa-p/13704500#M4829720</guid>
      <dc:creator>kbachl</dc:creator>
      <dc:date>2024-05-17T08:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: Ruby API returns different result based on same SQL but prepared vs execute_direct</title>
      <link>https://community.sap.com/t5/technology-q-a/ruby-api-returns-different-result-based-on-same-sql-but-prepared-vs-execute/qaa-p/13705282#M4829812</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/229882"&gt;@kbachl&lt;/a&gt;, thanks for trying the updated instructions. I can see from your trace that the string value isn't bound properly from the ruby level:&lt;/P&gt;&lt;LI-CODE lang="bash"&gt;10:13:01 web.1             | [SQLDBC] &amp;gt;StringTranslator::translateUTF8Input (2024-05-17 10:13:01.192845)
10:13:01 web.1             | [SQLDBC] data=
10:13:01 web.1             | [SQLDBC] &amp;gt;GenericTranslator::addCharacterData (2024-05-17 10:13:01.192855)
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] &amp;lt;=SQLDBC_OK
10:13:01 web.1             | [SQLDBC] 1     UTF8          0             0             ''&lt;/LI-CODE&gt;&lt;P&gt;I had been originally trying Ruby 2.7, but couldn't reproduce the problem:&lt;/P&gt;&lt;LI-CODE lang="bash"&gt;[SQLDBC] &amp;gt;GenericTranslator::addCharacterData (2024-05-17 16:21:08.715159)
[SQLDBC] &amp;lt;=SQLDBC_OK
[SQLDBC] &amp;lt;=SQLDBC_OK
[SQLDBC] &amp;lt;=SQLDBC_OK
[SQLDBC] 1     UTF8          9             9             'TestValue'&lt;/LI-CODE&gt;&lt;PRE&gt;&lt;SPAN&gt;ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-linux]&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;After I upgraded to the latest Ruby 3.3, I could then reproduce the problem as you described:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;ruby 3.3.1 (2024-04-23 revision c56cd86388) [x86_64-linux]&lt;/SPAN&gt;&lt;/PRE&gt;&lt;LI-CODE lang="bash"&gt;[SQLDBC] &amp;gt;GenericTranslator::addCharacterData (2024-05-17 16:13:54.026311)
[SQLDBC] &amp;lt;=SQLDBC_OK
[SQLDBC] &amp;lt;=SQLDBC_OK
[SQLDBC] &amp;lt;=SQLDBC_OK
[SQLDBC] 1     UTF8          0             0             ''&lt;/LI-CODE&gt;&lt;P&gt;I am also noticing these ruby messages in Ruby 3.3:&lt;/P&gt;&lt;LI-CODE lang="bash"&gt;simple.rb:7: warning: undefining the allocator of T_DATA class DBCAPI::a_hanaclient_connection
simple.rb:14: warning: undefining the allocator of T_DATA class DBCAPI::a_hanaclient_stmt
simple.rb:15: warning: undefining the allocator of T_DATA class DBCAPI::a_hanaclient_bind_data&lt;/LI-CODE&gt;&lt;P&gt;So it seems like there's a bug with newer Ruby versions here - I have opened an internal bug report to investigate further.&lt;/P&gt;&lt;P&gt;Can you try an older version of Ruby for now?&lt;/P&gt;&lt;P&gt;Note that the official Supported Platforms page only lists up to Ruby 2.7 currently: &lt;A href="https://me.sap.com/notes/3447024" target="_blank"&gt;https://me.sap.com/notes/3447024&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 20:29:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/ruby-api-returns-different-result-based-on-same-sql-but-prepared-vs-execute/qaa-p/13705282#M4829812</guid>
      <dc:creator>jeff_albion</dc:creator>
      <dc:date>2024-05-17T20:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Ruby API returns different result based on same SQL b...</title>
      <link>https://community.sap.com/t5/technology-q-a/ruby-api-returns-different-result-based-on-same-sql-but-prepared-vs-execute/qaa-p/13705309#M4829815</link>
      <description>&lt;P&gt;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/209056"&gt;@jeff_albion&lt;/a&gt;Thanks for the update!&lt;/P&gt;&lt;P&gt;I hardly can go on to ruby 2.7 as I'm doing a current new rails project and ruby 3.1.0 is the new baseline for upcoming rails 7.2, me using ruby 3.3.1.&lt;BR /&gt;Beside ruby 2.7 is EOL since 2023-03-31. Since I only need this on some rare occasions (when the SAP B1 ServiceLayer is too slow or can't deliver the complexity of a query well enough) I can go forward with using this with the direct SQL way of using ActiveRecord's base&lt;/P&gt;&lt;PRE&gt; sql = ActiveRecord::Base.sanitize_sql([sql, item_code])&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;for the time. Yet, it would also be nice if you could do a bug report that an access to a non existing row or column dont lead to a SegFault like in my last post as this is quite annoying in development &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 21:00:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/ruby-api-returns-different-result-based-on-same-sql-but-prepared-vs-execute/qaa-p/13705309#M4829815</guid>
      <dc:creator>kbachl</dc:creator>
      <dc:date>2024-05-17T21:00:42Z</dc:date>
    </item>
  </channel>
</rss>

