[Home]

Summary:ASTERISK-17392: [patch] func_odbc insertsql option may not work
Reporter:Gregory Hinton Nietsky (irroot)Labels:
Date Opened:2011-02-11 05:39:40.000-0600Date Closed:2011-02-16 15:44:13.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Functions/func_odbc
Versions:1.6.2.15 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20110211__issue18795.diff.txt
( 1) func_odbc.insert.patch
( 2) func_odbc.insert3.patch
Description:Hi there the insert option was a patch set i submitted a while back and see is in 1.6 needed to add the attached patch to get it working.
Comments:By: Leif Madsen (lmadsen) 2011-02-11 12:23:49.000-0600

You may be interested in this?

By: Tilghman Lesher (tilghman) 2011-02-11 16:28:30.000-0600

This patch is not correct.  The statement must exist.  That is, the statement (an UPDATE) SUCCESSFULLY executed and affected zero rows.  What this change says is that the statement DID NOT execute.



By: Tilghman Lesher (tilghman) 2011-02-11 16:36:04.000-0600

I do see there is an error, in that we are not querying the number of rows affected before checking that value, so that's certainly a bug.  Patch attached to fix that error.

By: Gregory Hinton Nietsky (irroot) 2011-02-12 03:03:31.000-0600

I belive that there are times when the stmt may not execute and the insertsql command should still be run. in my application the stmt certainly does fail its possible to rearrange it to take all options into account.Thx for the feedback.

By: Gregory Hinton Nietsky (irroot) 2011-02-12 08:46:08.000-0600

here is a patch that works both ways ... its somehow got html encoded ... can repost if needed sorry about that

By: Tilghman Lesher (tilghman) 2011-02-14 00:23:57.000-0600

No, the insert statement may ONLY run if the regular one succeeded, but affected 0 rows.  This is not open to negotiation.  If your statement is failing, then you need to diagnose why it's failing and fix that.

By: Digium Subversion (svnbot) 2011-02-15 01:01:39.000-0600

Repository: asterisk
Revision: 307836

U   branches/1.6.2/funcs/func_odbc.c

------------------------------------------------------------------------
r307836 | tilghman | 2011-02-15 01:01:39 -0600 (Tue, 15 Feb 2011) | 8 lines

Need to retrieve the rows affected before using the associated variable.

(closes issue ASTERISK-17392)
Reported by: irroot
Patches:
      20110211__issue18795.diff.txt uploaded by tilghman (license 14)
Tested by: tilghman

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=307836

By: Digium Subversion (svnbot) 2011-02-15 01:02:45.000-0600

Repository: asterisk
Revision: 307837

_U  branches/1.8/
U   branches/1.8/funcs/func_odbc.c

------------------------------------------------------------------------
r307837 | tilghman | 2011-02-15 01:02:45 -0600 (Tue, 15 Feb 2011) | 15 lines

Merged revisions 307836 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

........
 r307836 | tilghman | 2011-02-15 01:01:37 -0600 (Tue, 15 Feb 2011) | 8 lines
 
 Need to retrieve the rows affected before using the associated variable.
 
 (closes issue ASTERISK-17392)
  Reported by: irroot
  Patches:
        20110211__issue18795.diff.txt uploaded by tilghman (license 14)
  Tested by: tilghman
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=307837

By: Digium Subversion (svnbot) 2011-02-15 01:03:45.000-0600

Repository: asterisk
Revision: 307838

_U  trunk/
U   trunk/funcs/func_odbc.c

------------------------------------------------------------------------
r307838 | tilghman | 2011-02-15 01:03:45 -0600 (Tue, 15 Feb 2011) | 22 lines

Merged revisions 307837 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
 r307837 | tilghman | 2011-02-15 01:02:45 -0600 (Tue, 15 Feb 2011) | 15 lines
 
 Merged revisions 307836 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.6.2
 
 ........
   r307836 | tilghman | 2011-02-15 01:01:37 -0600 (Tue, 15 Feb 2011) | 8 lines
   
   Need to retrieve the rows affected before using the associated variable.
   
   (closes issue ASTERISK-17392)
    Reported by: irroot
    Patches:
          20110211__issue18795.diff.txt uploaded by tilghman (license 14)
    Tested by: tilghman
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=307838