From 815ef984025c39051966f24ad1a69ca5f3b722f6 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 10 Apr 2010 12:20:45 +0200 Subject: [PATCH] Revert "Add header to both myingres.sc and myingres.sh" This reverts commit 48b0b5ad1151b98c6bb36ac8f00230ac34ce7fc9. --- bacula/src/cats/myingres.c | 157 ++++++++++++++---------------------- bacula/src/cats/myingres.h | 24 +----- bacula/src/cats/myingres.sc | 82 +++++-------------- bacula/src/cats/myingres.sh | 27 ------- 4 files changed, 84 insertions(+), 206 deletions(-) diff --git a/bacula/src/cats/myingres.c b/bacula/src/cats/myingres.c index 620ba9f5dc..ea41efdc3f 100644 --- a/bacula/src/cats/myingres.c +++ b/bacula/src/cats/myingres.c @@ -1,38 +1,5 @@ -/* - Bacula® - The Network Backup Solution - Copyright (C) 2009-2010 Free Software Foundation Europe e.V. - The main author of Bacula is Kern Sibbald, with contributions from - many others, a complete list can be found in the file AUTHORS. - This program is Free Software; you can redistribute it and/or - modify it under the terms of version two of the GNU General Public - License as published by the Free Software Foundation and included - in the file LICENSE. - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. - Bacula® is a registered trademark of Kern Sibbald. - The licensor of Bacula is the Free Software Foundation Europe - (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, - Switzerland, email:ftf@fsfeurope.org. -*/ -/* - * Bacula Catalog Database routines specific to Ingres - * These are Ingres specific routines - * - * Stefan Reddig, June 2009 - */ -/* The following is necessary so that we do not include - * the dummy external definition of DB. - */ -#define __SQL_C /* indicate that this is sql.c */ #include "bacula.h" -#include "cats.h" -/* # line 43 "myingres.sc" */ +/* # line 3 "myingres.sc" */ #ifdef HAVE_INGRES #include #include @@ -53,10 +20,10 @@ int INGcheck() short INGgetCols(B_DB *mdb, const char *query) { bool stmt_free = false; -/* # line 64 "myingres.sc" */ +/* # line 24 "myingres.sc" */ char *stmt; -/* # line 66 "myingres.sc" */ +/* # line 26 "myingres.sc" */ short number = 1; IISQLDA *sqlda; @@ -72,22 +39,22 @@ short INGgetCols(B_DB *mdb, const char *query) stmt = bstrdup(query); stmt_free = true; } -/* # line 86 "myingres.sc" */ /* prepare */ +/* # line 46 "myingres.sc" */ /* prepare */ { IIsqInit(&sqlca); IIsqPrepare(0,(char *)"s1",(char *)0,0,stmt); } -/* # line 87 "myingres.sc" */ /* host code */ +/* # line 47 "myingres.sc" */ /* host code */ if (INGcheck() < 0) { number = -1; goto bail_out; } -/* # line 92 "myingres.sc" */ /* describe */ +/* # line 52 "myingres.sc" */ /* describe */ { IIsqInit(&sqlca); IIsqDescribe(0,(char *)"s1",sqlda,0); } -/* # line 93 "myingres.sc" */ /* host code */ +/* # line 53 "myingres.sc" */ /* host code */ if (INGcheck() < 0) { number = -1; goto bail_out; @@ -103,10 +70,10 @@ bail_out: static inline IISQLDA *INGgetDescriptor(B_DB *mdb, short numCols, const char *query) { bool stmt_free = false; -/* # line 111 "myingres.sc" */ +/* # line 71 "myingres.sc" */ char *stmt; -/* # line 113 "myingres.sc" */ +/* # line 73 "myingres.sc" */ int i; IISQLDA *sqlda; @@ -122,12 +89,12 @@ static inline IISQLDA *INGgetDescriptor(B_DB *mdb, short numCols, const char *qu stmt = bstrdup(query); stmt_free = true; } -/* # line 133 "myingres.sc" */ /* prepare */ +/* # line 93 "myingres.sc" */ /* prepare */ { IIsqInit(&sqlca); IIsqPrepare(0,(char *)"s2",sqlda,0,stmt); } -/* # line 135 "myingres.sc" */ /* host code */ +/* # line 95 "myingres.sc" */ /* host code */ if (stmt_free) { free(stmt); } @@ -230,23 +197,6 @@ static inline INGresult *INGgetINGresult(IISQLDA *sqlda) } return result; } -static inline void INGfreeRowSpace(ING_ROW *row, IISQLDA *sqlda) -{ - int i; - if (row == NULL || sqlda == NULL) { - return; - } - for (i = 0; i < sqlda->sqld; ++i) { - if (row->sqlvar[i].sqldata) { - free(row->sqlvar[i].sqldata); - } - if (row->sqlvar[i].sqlind) { - free(row->sqlvar[i].sqlind); - } - } - free(row->sqlvar); - free(row); -} static void INGfreeINGresult(INGresult *ing_res) { int rows; @@ -348,6 +298,23 @@ static inline ING_ROW *INGgetRowSpace(INGresult *ing_res) } return row; } +static inline void INGfreeRowSpace(ING_ROW *row, IISQLDA *sqlda) +{ + int i; + if (row == NULL || sqlda == NULL) { + return; + } + for (i = 0; i < sqlda->sqld; ++i) { + if (row->sqlvar[i].sqldata) { + free(row->sqlvar[i].sqldata); + } + if (row->sqlvar[i].sqlind) { + free(row->sqlvar[i].sqlind); + } + } + free(row->sqlvar); + free(row); +} static inline int INGfetchAll(const char *query, INGresult *ing_res) { int linecount = 0; @@ -355,32 +322,32 @@ static inline int INGfetchAll(const char *query, INGresult *ing_res) IISQLDA *desc; int check = -1; desc = ing_res->sqlda; -/* # line 392 "myingres.sc" */ /* host code */ +/* # line 352 "myingres.sc" */ /* host code */ if ((check = INGcheck()) < 0) { return check; } -/* # line 396 "myingres.sc" */ /* open */ +/* # line 356 "myingres.sc" */ /* open */ { IIsqInit(&sqlca); - IIcsOpen((char *)"c2",4150,23546); + IIcsOpen((char *)"c2",9209,14491); IIwritio(0,(short *)0,1,32,0,(char *)"s2"); - IIcsQuery((char *)"c2",4150,23546); + IIcsQuery((char *)"c2",9209,14491); } -/* # line 397 "myingres.sc" */ /* host code */ +/* # line 357 "myingres.sc" */ /* host code */ if ((check = INGcheck()) < 0) { return check; } /* for (linecount = 0; sqlca.sqlcode == 0; ++linecount) */ do { -/* # line 403 "myingres.sc" */ /* fetch */ +/* # line 363 "myingres.sc" */ /* fetch */ { IIsqInit(&sqlca); - if (IIcsRetScroll((char *)"c2",4150,23546,-1,-1) != 0) { + if (IIcsRetScroll((char *)"c2",9209,14491,-1,-1) != 0) { IIcsDaGet(0,desc); IIcsERetrieve(); } /* IIcsRetrieve */ } -/* # line 405 "myingres.sc" */ /* host code */ +/* # line 365 "myingres.sc" */ /* host code */ if ( (sqlca.sqlcode == 0) || (sqlca.sqlcode == -40202) ) { row = INGgetRowSpace(ing_res); /* alloc space for fetched row */ /* @@ -397,12 +364,12 @@ static inline int INGfetchAll(const char *query, INGresult *ing_res) ++linecount; } } while ( (sqlca.sqlcode == 0) || (sqlca.sqlcode == -40202) ); -/* # line 423 "myingres.sc" */ /* close */ +/* # line 383 "myingres.sc" */ /* close */ { IIsqInit(&sqlca); - IIcsClose((char *)"c2",4150,23546); + IIcsClose((char *)"c2",9209,14491); } -/* # line 425 "myingres.sc" */ /* host code */ +/* # line 385 "myingres.sc" */ /* host code */ ing_res->status = ING_COMMAND_OK; ing_res->num_rows = linecount; return linecount; @@ -471,11 +438,11 @@ int INGexec(B_DB *mdb, INGconn *conn, const char *query) { bool stmt_free = false; int check; -/* # line 507 "myingres.sc" */ +/* # line 467 "myingres.sc" */ int rowcount; char *stmt; -/* # line 510 "myingres.sc" */ +/* # line 470 "myingres.sc" */ /* * See if we need to run this through the limit_filter. @@ -487,24 +454,24 @@ int INGexec(B_DB *mdb, INGconn *conn, const char *query) stmt_free = true; } rowcount = -1; -/* # line 523 "myingres.sc" */ /* execute */ +/* # line 483 "myingres.sc" */ /* execute */ { IIsqInit(&sqlca); IIsqExImmed(stmt); IIsyncup((char *)0,0); } -/* # line 525 "myingres.sc" */ /* host code */ +/* # line 485 "myingres.sc" */ /* host code */ if (stmt_free) { free(stmt); } if ((check = INGcheck()) < 0) { return check; } -/* # line 533 "myingres.sc" */ /* inquire_ingres */ +/* # line 493 "myingres.sc" */ /* inquire_ingres */ { IILQisInqSqlio((short *)0,1,30,sizeof(rowcount),&rowcount,8); } -/* # line 534 "myingres.sc" */ /* host code */ +/* # line 494 "myingres.sc" */ /* host code */ if ((check = INGcheck()) < 0) { return check; } @@ -519,7 +486,7 @@ INGresult *INGquery(B_DB *mdb, INGconn *conn, const char *query) INGresult *res = NULL; int rows = -1; int cols = INGgetCols(mdb, query); - desc = INGgetDescriptor(mdb, cols, query); + desc = INGgetDescriptor(cols, query); if (!desc) { return NULL; } @@ -551,14 +518,14 @@ INGconn *INGconnectDB(char *dbname, char *user, char *passwd) } dbconn = (INGconn *)malloc(sizeof(INGconn)); memset(dbconn, 0, sizeof(INGconn)); -/* # line 590 "myingres.sc" */ +/* # line 550 "myingres.sc" */ char ingdbname[24]; char ingdbuser[32]; char ingdbpasw[32]; char conn_name[32]; int sess_id; -/* # line 596 "myingres.sc" */ +/* # line 556 "myingres.sc" */ bstrncpy(ingdbname, dbname, sizeof(ingdbname)); if (user != NULL) { @@ -568,7 +535,7 @@ INGconn *INGconnectDB(char *dbname, char *user, char *passwd) } else { memset(ingdbpasw, 0, sizeof(ingdbpasw)); } -/* # line 607 "myingres.sc" */ /* connect */ +/* # line 567 "myingres.sc" */ /* connect */ { IIsqInit(&sqlca); IIsqUser(ingdbuser); @@ -576,26 +543,26 @@ INGconn *INGconnectDB(char *dbname, char *user, char *passwd) (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0); } -/* # line 611 "myingres.sc" */ /* host code */ +/* # line 571 "myingres.sc" */ /* host code */ } else { -/* # line 612 "myingres.sc" */ /* connect */ +/* # line 572 "myingres.sc" */ /* connect */ { IIsqInit(&sqlca); IIsqConnect(0,ingdbname,(char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0, (char *)0); } -/* # line 613 "myingres.sc" */ /* host code */ +/* # line 573 "myingres.sc" */ /* host code */ } -/* # line 615 "myingres.sc" */ /* inquire_sql */ +/* # line 575 "myingres.sc" */ /* inquire_sql */ { IILQisInqSqlio((short *)0,1,32,31,conn_name,13); } -/* # line 616 "myingres.sc" */ /* inquire_sql */ +/* # line 576 "myingres.sc" */ /* inquire_sql */ { IILQisInqSqlio((short *)0,1,30,sizeof(sess_id),&sess_id,11); } -/* # line 618 "myingres.sc" */ /* host code */ +/* # line 578 "myingres.sc" */ /* host code */ bstrncpy(dbconn->dbname, ingdbname, sizeof(dbconn->dbname)); bstrncpy(dbconn->user, ingdbuser, sizeof(dbconn->user)); bstrncpy(dbconn->password, ingdbpasw, sizeof(dbconn->password)); @@ -610,12 +577,12 @@ void INGdisconnectDB(INGconn *dbconn) /* * TODO: check for any real use of dbconn: maybe whenn multithreaded? */ -/* # line 634 "myingres.sc" */ /* disconnect */ +/* # line 594 "myingres.sc" */ /* disconnect */ { IIsqInit(&sqlca); IIsqDisconnect(); } -/* # line 635 "myingres.sc" */ /* host code */ +/* # line 595 "myingres.sc" */ /* host code */ if (dbconn != NULL) { free(dbconn->msg); free(dbconn); @@ -623,16 +590,16 @@ void INGdisconnectDB(INGconn *dbconn) } char *INGerrorMessage(const INGconn *conn) { -/* # line 643 "myingres.sc" */ +/* # line 603 "myingres.sc" */ char errbuf[256]; -/* # line 645 "myingres.sc" */ +/* # line 605 "myingres.sc" */ -/* # line 647 "myingres.sc" */ /* inquire_ingres */ +/* # line 607 "myingres.sc" */ /* inquire_ingres */ { IILQisInqSqlio((short *)0,1,32,255,errbuf,63); } -/* # line 648 "myingres.sc" */ /* host code */ +/* # line 608 "myingres.sc" */ /* host code */ memcpy(conn->msg, &errbuf, 256); return conn->msg; } @@ -644,5 +611,5 @@ char *INGcmdTuples(INGresult *res) int INGputCopyEnd(INGconn *conn, const char *errormsg); int INGputCopyData(INGconn *conn, const char *buffer, int nbytes); */ -/* # line 662 "myingres.sc" */ +/* # line 622 "myingres.sc" */ #endif diff --git a/bacula/src/cats/myingres.h b/bacula/src/cats/myingres.h index d867fc9a6b..6fb6f4e45a 100644 --- a/bacula/src/cats/myingres.h +++ b/bacula/src/cats/myingres.h @@ -1,25 +1,3 @@ -/* - Bacula® - The Network Backup Solution - Copyright (C) 2009-2010 Free Software Foundation Europe e.V. - The main author of Bacula is Kern Sibbald, with contributions from - many others, a complete list can be found in the file AUTHORS. - This program is Free Software; you can redistribute it and/or - modify it under the terms of version two of the GNU General Public - License as published by the Free Software Foundation and included - in the file LICENSE. - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. - Bacula® is a registered trademark of Kern Sibbald. - The licensor of Bacula is the Free Software Foundation Europe - (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, - Switzerland, email:ftf@fsfeurope.org. -*/ #ifndef _MYINGRES_SH #define _MYINGRES_SH #include @@ -85,5 +63,5 @@ INGconn *INGconnectDB(char *dbname, char *user, char *passwd); void INGdisconnectDB(INGconn *dbconn); char *INGerrorMessage(const INGconn *conn); char *INGcmdTuples(INGresult *res); -/* # line 102 "myingres.sh" */ +/* # line 75 "myingres.sh" */ #endif /* _MYINGRES_SH */ diff --git a/bacula/src/cats/myingres.sc b/bacula/src/cats/myingres.sc index 9c65d64164..5425730321 100644 --- a/bacula/src/cats/myingres.sc +++ b/bacula/src/cats/myingres.sc @@ -1,44 +1,4 @@ -/* - Bacula® - The Network Backup Solution - - Copyright (C) 2009-2010 Free Software Foundation Europe e.V. - - The main author of Bacula is Kern Sibbald, with contributions from - many others, a complete list can be found in the file AUTHORS. - This program is Free Software; you can redistribute it and/or - modify it under the terms of version two of the GNU General Public - License as published by the Free Software Foundation and included - in the file LICENSE. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. - - Bacula® is a registered trademark of Kern Sibbald. - The licensor of Bacula is the Free Software Foundation Europe - (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, - Switzerland, email:ftf@fsfeurope.org. -*/ -/* - * Bacula Catalog Database routines specific to Ingres - * These are Ingres specific routines - * - * Stefan Reddig, June 2009 - */ - -/* The following is necessary so that we do not include - * the dummy external definition of DB. - */ -#define __SQL_C /* indicate that this is sql.c */ - #include "bacula.h" -#include "cats.h" #ifdef HAVE_INGRES EXEC SQL INCLUDE SQLCA; @@ -250,26 +210,6 @@ static inline INGresult *INGgetINGresult(IISQLDA *sqlda) return result; } -static inline void INGfreeRowSpace(ING_ROW *row, IISQLDA *sqlda) -{ - int i; - - if (row == NULL || sqlda == NULL) { - return; - } - - for (i = 0; i < sqlda->sqld; ++i) { - if (row->sqlvar[i].sqldata) { - free(row->sqlvar[i].sqldata); - } - if (row->sqlvar[i].sqlind) { - free(row->sqlvar[i].sqlind); - } - } - free(row->sqlvar); - free(row); -} - static void INGfreeINGresult(INGresult *ing_res) { int rows; @@ -379,6 +319,26 @@ static inline ING_ROW *INGgetRowSpace(INGresult *ing_res) return row; } +static inline void INGfreeRowSpace(ING_ROW *row, IISQLDA *sqlda) +{ + int i; + + if (row == NULL || sqlda == NULL) { + return; + } + + for (i = 0; i < sqlda->sqld; ++i) { + if (row->sqlvar[i].sqldata) { + free(row->sqlvar[i].sqldata); + } + if (row->sqlvar[i].sqlind) { + free(row->sqlvar[i].sqlind); + } + } + free(row->sqlvar); + free(row); +} + static inline int INGfetchAll(const char *query, INGresult *ing_res) { int linecount = 0; @@ -548,7 +508,7 @@ INGresult *INGquery(B_DB *mdb, INGconn *conn, const char *query) int rows = -1; int cols = INGgetCols(mdb, query); - desc = INGgetDescriptor(mdb, cols, query); + desc = INGgetDescriptor(cols, query); if (!desc) { return NULL; } diff --git a/bacula/src/cats/myingres.sh b/bacula/src/cats/myingres.sh index f96b340951..8cbf0415ec 100644 --- a/bacula/src/cats/myingres.sh +++ b/bacula/src/cats/myingres.sh @@ -1,30 +1,3 @@ -/* - Bacula® - The Network Backup Solution - - Copyright (C) 2009-2010 Free Software Foundation Europe e.V. - - The main author of Bacula is Kern Sibbald, with contributions from - many others, a complete list can be found in the file AUTHORS. - This program is Free Software; you can redistribute it and/or - modify it under the terms of version two of the GNU General Public - License as published by the Free Software Foundation and included - in the file LICENSE. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. - - Bacula® is a registered trademark of Kern Sibbald. - The licensor of Bacula is the Free Software Foundation Europe - (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, - Switzerland, email:ftf@fsfeurope.org. -*/ #ifndef _MYINGRES_SH #define _MYINGRES_SH -- 2.39.5