* NOTE! len is the length of the old string. Your new
* string must be long enough (max 2*old+1) to hold
* the escaped output.
- * SRE: TODO!
*/
void
db_escape_string(JCR *jcr, B_DB *mdb, char *snew, char *old, int len)
{
-/*
- int error;
-
- PQescapeStringConn(mdb->db, snew, old, len, &error);
- if (error) {
- Jmsg(jcr, M_FATAL, 0, _("PQescapeStringConn returned non-zero.\n"));*/
- /* error on encoding, probably invalid multibyte encoding in the source string
- see PQescapeStringConn documentation for details. */
-/* Dmsg0(500, "PQescapeStringConn failed\n");
- }*/
+ char *n, *o;
+
+ n = snew;
+ o = old;
+ while (len--) {
+ switch (*o) {
+ case '\'':
+ *n++ = '\'';
+ *n++ = '\'';
+ o++;
+ break;
+ case 0:
+ *n++ = '\\';
+ *n++ = 0;
+ o++;
+ break;
+ default:
+ *n++ = *o++;
+ break;
+ }
+ }
+ *n = 0;
}
/*
#include "bacula.h"
/* # line 3 "myingres.sc" */
#ifdef HAVE_INGRES
-#include <eqdefc.h>
+#include <eqdef.h>
#include <eqsqlca.h>
extern IISQLCA sqlca; /* SQL Communications Area */
#include <eqsqlda.h>
++linecount;
row->row_number = linecount;
}
- } while ( (sqlca.sqlcode == 0) || (sqlca.sqlcode == -40202) )
+ } while ( (sqlca.sqlcode == 0) || (sqlca.sqlcode == -40202) );
/* # line 348 "myingres.sc" */ /* close */
{
IIsqInit(&sqlca);
void INGrowSeek(INGresult *res, int row_number)
{
ING_ROW *trow = NULL;
- int i;
if (res->act_row->row_number == row_number) {
return;
}
if (row_number<0 || row_number>res->num_rows) {
return;
}
- for (trow = res->first_row , i=1 ; trow->row_number != row_number , i <= res->num_rows; trow = trow->next , ++i);
+ for (trow = res->first_row ; trow->row_number != row_number; trow = trow->next);
res->act_row = trow;
/*
* Note - can be null - if row_number not found, right?