Bug #559

idoutils libdbi 0.8.3 deprecated functions dbi_result_get_(u)long

Added by dnsmichi almost 4 years ago. Updated over 3 years ago.

Status:ResolvedStart date:07/01/2010
Priority:LowDue date:
Assignee:dnsmichi% Done:

100%

Category:RDBMS
Target version:Icinga 1.x - 1.3
Icinga Version: DB Type:
IDO Version: DB Version:

Description

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;
                          }
                  }

Associated revisions

Revision c1b37d49
Added by dnsmichi over 3 years ago

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

fixes #559

Revision d730df26
Added by dnsmichi over 3 years ago

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

fixes #559

History

#1 Updated by dnsmichi almost 4 years ago

  • Project changed from Core to IDOUtils
  • Category deleted (Event Broker)
  • Target version deleted (1.0.3)

#2 Updated by dnsmichi almost 4 years ago

  • Category set to RDBMS

#3 Updated by dnsmichi over 3 years ago

  • 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.

#4 Updated by dnsmichi over 3 years ago

  • 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 ?

#5 Updated by dnsmichi over 3 years ago

  • 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.

#6 Updated by dnsmichi over 3 years ago

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

Applied in changeset commit:"c1b37d49d59e57405112990aed54a578a2b64afd".

Also available in: Atom PDF