~ubuntu-dev/ubuntu/lucid/zabbix/lucid-201002110857

« back to all changes in this revision

Viewing changes to src/libs/zbxdb/db.c

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Haas
  • Date: 2009-10-10 12:21:16 UTC
  • mfrom: (1.1.10 upstream) (8.2.6 sid)
  • Revision ID: james.westby@ubuntu.com-20091010122116-44k2zdq57rb40i6z
Tags: 1:1.6.6-2
* debian/po/ja.po updated (Closes: #548651)
* debian/po/cs.po updated (Closes: #548675)
* debian/po/sv.po updated (Closes: #548796)
* debian/po/de.po updated (Closes: #549248)
* debian/po/it.po updated (Closes: #549579)
* debian/po/pt.po updated (Closes: #550087)
* debian/po/ru.po updated (Closes: #550102)
* debian/po/es.po updated (Closes: #550173)
* debian/po/fr.po updated (Closes: #550315)
* Manpages for zabbix_server and zabbix_agent added (Closes: #496696)
* Added hint about the difference of the zabbix_agent.conf and
  zabbix_agentd.conf in each config file as a comment. (Closes: #548701)

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
        if (ZBX_DB_FAIL == ret)
105
105
        {
106
106
                switch (mysql_errno(conn)) {
 
107
                case CR_CONN_HOST_ERROR:
107
108
                case CR_SERVER_GONE_ERROR:
108
109
                case CR_CONNECTION_ERROR:
109
110
                case CR_SERVER_LOST:
122
123
        char            *cport = NULL;
123
124
        DB_RESULT       result;
124
125
        DB_ROW          row;
 
126
        int             sversion;
125
127
 
126
128
        if( port )      cport = zbx_dsprintf(cport, "%i", port);
127
129
 
144
146
        }
145
147
        DBfree_result(result);
146
148
 
 
149
#ifdef  HAVE_FUNCTION_PQSERVERVERSION
 
150
        sversion = PQserverVersion(conn);
 
151
        zabbix_log(LOG_LEVEL_DEBUG, "PostgreSQL Server version: %d", sversion);
 
152
#else
 
153
        sversion = 0;
 
154
#endif  /* HAVE_FUNCTION_PQSERVERVERSION */
 
155
 
 
156
        if (sversion >= 80100)
 
157
        {
 
158
                /* disable "nonstandard use of \' in a string literal" warning */
 
159
                DBexecute("set escape_string_warning to off");
 
160
        }
 
161
 
147
162
        return ret;
148
163
#endif
149
164
#ifdef  HAVE_ORACLE
429
444
                {
430
445
                        zabbix_errlog(ERR_Z3005, mysql_errno(conn), mysql_error(conn), sql);
431
446
                        switch(mysql_errno(conn)) {
 
447
                                case    CR_CONN_HOST_ERROR:
432
448
                                case    CR_SERVER_GONE_ERROR:
433
449
                                case    CR_CONNECTION_ERROR:
434
450
                                case    CR_SERVER_LOST:
701
717
                {
702
718
                        zabbix_errlog(ERR_Z3005, mysql_errno(conn), mysql_error(conn), sql);
703
719
                        switch(mysql_errno(conn)) {
 
720
                                case    CR_CONN_HOST_ERROR:
704
721
                                case    CR_SERVER_GONE_ERROR:
705
722
                                case    CR_CONNECTION_ERROR:
706
723
                                case    CR_SERVER_LOST:
721
738
#endif
722
739
#ifdef  HAVE_POSTGRESQL
723
740
        result = zbx_malloc(NULL, sizeof(ZBX_PG_DB_RESULT));
724
 
        result->pg_result = PQexec(conn,sql);
 
741
        result->pg_result = PQexec(conn, sql);
725
742
        result->values = NULL;
726
743
        result->cursor = 0;
 
744
        result->row_num = 0;
727
745
 
728
 
        if(result->pg_result==NULL)
 
746
        if (NULL == result->pg_result)
729
747
        {
730
748
                zabbix_errlog(ERR_Z3005, 0, "Result is NULL", sql);
731
 
                exit(FAIL);
732
749
        }
733
 
        if( PQresultStatus(result->pg_result) != PGRES_TUPLES_OK)
 
750
        if (PGRES_TUPLES_OK != PQresultStatus(result->pg_result))
734
751
        {
735
752
                error = zbx_dsprintf(error, "%s:%s",
736
753
                                PQresStatus(PQresultStatus(result->pg_result)),
737
754
                                PQresultErrorMessage(result->pg_result));
738
755
                zabbix_errlog(ERR_Z3005, 0, error, sql);
739
756
                zbx_free(error);
740
 
                exit(FAIL);
741
757
        }
742
 
        
743
 
        /* init rownum */       
744
 
        result->row_num = PQntuples(result->pg_result);
 
758
        else    /* init rownum */
 
759
                result->row_num = PQntuples(result->pg_result);
745
760
 
746
761
#endif
747
762
#ifdef  HAVE_ORACLE