[dev.icinga.com #559] idoutils libdbi 0.8.3 deprecated functions dbi_result_get_(u)long #269

Closed
icinga-migration opened this Issue Jul 1, 2010 · 7 comments

Comments

Projects
None yet
1 participant
Member

icinga-migration commented Jul 1, 2010

This issue has been migrated from Redmine: https://dev.icinga.com/issues/559

Created by mfriedrich on 2010-07-01 10:33:45 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2011-01-12 16:32:33 +00:00)
Target Version: 1.3
Last Update: 2014-12-08 14:46:09 +00:00 (in Redmine)

Icinga Version: 1.10.0
OS Version: any

changed, see comment below.

*** dbhandlers.c    2010-07-01 08:07:57.000000000 +0200
--- dbhandlers.c~   2010-06-30 11:13:42.000000000 +0200
***************
*** 524,532 ****
    if ((result = ido2db_db_query(idi, buf)) == IDO_OK) {
        while (idi->dbinfo.dbi_result) {
            if (dbi_result_next_row(idi->dbinfo.dbi_result)) {
!               object_id = dbi_result_get_ulong(idi->dbinfo.dbi_result,
                        "object_id");
!               objecttype_id = dbi_result_get_long(idi->dbinfo.dbi_result,
                        "objecttype_id");
                ido2db_add_cached_object_id(idi, objecttype_id,
                        dbi_result_get_string_copy(idi->dbinfo.dbi_result,
--- 524,532 ----
    if ((result = ido2db_db_query(idi, buf)) == IDO_OK) {
        while (idi->dbinfo.dbi_result) {
            if (dbi_result_next_row(idi->dbinfo.dbi_result)) {
!               object_id = dbi_result_get_uint(idi->dbinfo.dbi_result,
                        "object_id");
!               objecttype_id = dbi_result_get_int(idi->dbinfo.dbi_result,
                        "objecttype_id");
                ido2db_add_cached_object_id(idi, objecttype_id,
                        dbi_result_get_string_copy(idi->dbinfo.dbi_result,


db.c.ubuntu_606.patch

*** db.c    2010-07-01 08:07:03.000000000 +0200
--- db.c~   2010-06-30 11:13:42.000000000 +0200
***************
*** 1084,1090 ****

        if (idi->dbinfo.dbi_result != NULL) {
            if (dbi_result_next_row(idi->dbinfo.dbi_result)) {
!               idi->dbinfo.instance_id = dbi_result_get_ulong(idi->dbinfo.dbi_result, "instance_id");
                have_instance = IDO_TRUE;
            }
        }
--- 1084,1090 ----

        if (idi->dbinfo.dbi_result != NULL) {
            if (dbi_result_next_row(idi->dbinfo.dbi_result)) {
!               idi->dbinfo.instance_id = dbi_result_get_uint(idi->dbinfo.dbi_result, "instance_id");
                have_instance = IDO_TRUE;
            }
        }
***************
*** 1434,1440 ****

                  if (idi->dbinfo.dbi_result != NULL) {
                          if (dbi_result_next_row(idi->dbinfo.dbi_result)) {
!                                 idi->dbinfo.instance_id = dbi_result_get_ulong(idi->dbinfo.dbi_result, "instance_id");
                                  have_instance = IDO_TRUE;
                          }
                  }
--- 1434,1440 ----

                  if (idi->dbinfo.dbi_result != NULL) {
                          if (dbi_result_next_row(idi->dbinfo.dbi_result)) {
!                                 idi->dbinfo.instance_id = dbi_result_get_uint(idi->dbinfo.dbi_result, "instance_id");
                                  have_instance = IDO_TRUE;
                          }
                  }

Changesets

2011-01-12 09:07:39 +00:00 by mfriedrich c1b37d4

idoutils: fix libdbi 0.8.3 deprecated functions dbi_result_get_(u)long #559

fixes #559

2011-01-13 14:50:16 +00:00 by mfriedrich d730df2

idoutils: fix libdbi 0.8.3 deprecated functions dbi_result_get_(u)long #559

fixes #559
Member

icinga-migration commented Jul 9, 2010

Updated by mfriedrich on 2010-07-09 14:14:47 +00:00

  • Project changed from Core, Classic UI, IDOUtils to 18
  • Category deleted Event Broker
  • Target Version deleted 1.0.3
Member

icinga-migration commented Jul 9, 2010

Updated by mfriedrich on 2010-07-09 16:28:16 +00:00

  • Category set to 24
Member

icinga-migration commented Aug 3, 2010

Updated by mfriedrich on 2010-08-03 17:12:02 +00:00

  • Subject changed from idoutils libdbi on ubuntu 6.06 to idoutils libdbi 0.8.3 deprecated functions dbi_result_get(u)long_
  • Target Version set to 1.0.3

hm, we should only use the !deprecated versions.... it seems that the 8.3 libdbi creates such compiler warnings.

http://libdbi.sourcearchive.com/documentation/0.8.2/dbi\_8h-source.html

unsigned int dbi_result_get_ulong(dbi_result Result, const char *fieldname); /* deprecated */
int LIBDBI_API_DEPRECATED dbi_result_get_long(dbi_result Result, const char *fieldname); /* deprecated */
unsigned int LIBDBI_API_DEPRECATED dbi_result_get_ulong(dbi_result Result, const char *fieldname); /* deprecated */

#
make[2]: Entering directory `/home/icinga-git/icinga-core/module/idoutils/src'
#
gcc -fPIC -g -O2  -DHAVE_CONFIG_H  -c -o io.o io.c
#
gcc -fPIC -g -O2  -DHAVE_CONFIG_H  -c -o utils.o utils.c
#
gcc -g -O2  -DHAVE_CONFIG_H  -o file2sock file2sock.c io.o utils.o   -lm
#
gcc -g -O2  -DHAVE_CONFIG_H  -o log2ido log2ido.c io.o utils.o   -lm
#
gcc -g -O2  -DHAVE_CONFIG_H  -c -o db.o db.c
#
gcc -g -O2  -DHAVE_CONFIG_H  -c -o dbhandlers.o dbhandlers.c
#
dbhandlers.c: In function âido2db_get_object_idâ:
#
dbhandlers.c:151: warning: âdbi_result_get_ulongâ is deprecated (declared at /usr/include/dbi/dbi.h:266)

3.7.10. dbi_result_get_ulong

unsigned int dbi_result_get_ulong(dbi_result Result, const char *fieldname);

This is the same as dbi_result_get_uint. The use of this function is deprecated as the name implies the wrong return type on 64-bit platforms.

http://libdbi.sourceforge.net/docs/programmers-guide/reference-field.html

so i'll change the topic.

Member

icinga-migration commented Aug 4, 2010

Updated by mfriedrich on 2010-08-04 14:09:21 +00:00

  • Priority changed from Normal to Low
  • Target Version deleted 1.0.3

hm, i am confused looking at the sources - which ones should be used. old deprecated long causing trouble on x64 or int ?

Member

icinga-migration commented Jan 12, 2011

Updated by mfriedrich on 2011-01-12 09:06:02 +00:00

  • Status changed from New to Assigned
  • Target Version set to 1.3

considering the fact that idoutils uses old and deprecated *long in combination with *int, i'll clean the code a bit.

http://libdbi.sourceforge.net/docs/programmers-guide/reference-field.html

module/idoutils/src/dbhandlers.c:                               *object_id = dbi_result_get_ulong(idi->dbinfo.dbi_result, "object_id");
module/idoutils/src/dbhandlers.c:                               object_id = dbi_result_get_uint(idi->dbinfo.dbi_result,
module/idoutils/src/dbhandlers.c:                               objecttype_id = dbi_result_get_int(idi->dbinfo.dbi_result,
module/idoutils/src/dbhandlers.c:                                               dbi_result_get_string_copy(idi->dbinfo.dbi_result,
module/idoutils/src/dbhandlers.c:                                                               "name1"), dbi_result_get_string_copy(
module/idoutils/src/db.c:                                idi->dbinfo.dbversion = dbi_result_get_string(idi->dbinfo.dbi_result, "version");
module/idoutils/src/db.c:                               idi->dbinfo.instance_id = dbi_result_get_uint(idi->dbinfo.dbi_result, "instance_id");
module/idoutils/src/db.c:                                idi->dbinfo.instance_id = dbi_result_get_uint(idi->dbinfo.dbi_result, "instance_id");
module/idoutils/src/db.c:                               *t = dbi_result_get_datetime(idi->dbinfo.dbi_result, "latest_time");


$ grep -r dbi_result_get_ulong *
module/idoutils/src/dbhandlers.c:                               *object_id = dbi_result_get_ulong(idi->dbinfo.dbi_result, "object_id");

it should resolve for now, and i do think that latest libdbi will compile on older ubuntu versions too.

Member

icinga-migration commented Jan 12, 2011

Updated by mfriedrich on 2011-01-12 16:32:33 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 0 to 100

Applied in changeset commit:"c1b37d49d59e57405112990aed54a578a2b64afd".

Member

icinga-migration commented Dec 8, 2014

Updated by mfriedrich on 2014-12-08 14:46:09 +00:00

  • Project changed from 18 to Core, Classic UI, IDOUtils
  • Category changed from 24 to IDOUtils
  • Icinga Version set to 1
  • OS Version set to any

icinga-migration added this to the 1.3 milestone Jan 17, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment