File: ecpg.patch

package info (click to toggle)
postgresql 6.5.3-27
  • links: PTS
  • area: main
  • in suites: potato
  • size: 28,360 kB
  • ctags: 20,905
  • sloc: ansic: 204,608; yacc: 10,718; sql: 9,387; sh: 9,379; java: 8,835; tcl: 7,709; makefile: 3,376; lex: 1,642; perl: 1,034; python: 959; cpp: 847; asm: 70; pascal: 42; awk: 10; sed: 8
file content (80 lines) | stat: -rw-r--r-- 1,691 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
*** ecpglib.c.orig	Wed Dec 22 15:52:19 1999
--- ecpglib.c	Wed Dec 22 15:51:45 1999
***************
*** 228,235 ****
--- 228,238 ----
  		switch (arg[i])
  		{
  			case '\'':
+ 				res[ri++] = '\'';
+ 				break;
  			case '\\':
  				res[ri++] = '\\';
+ 				break;
  			default:
  				;
  		}
***************
*** 365,371 ****
  	bool		string = false;
  
  	for (; *ptr != '\0' && (*ptr != '?' || string); ptr++)
! 		if (*ptr == '\'')
  			string = string ? false : true;
  
  	return (*ptr == '\0') ? NULL : ptr;
--- 368,374 ----
  	bool		string = false;
  
  	for (; *ptr != '\0' && (*ptr != '?' || string); ptr++)
! 		if (*ptr == '\'' && *(ptr-1) != '\\')
  			string = string ? false : true;
  
  	return (*ptr == '\0') ? NULL : ptr;
***************
*** 379,384 ****
--- 382,388 ----
  	PGresult   *results;
  	PGnotify   *notify;
  	struct variable *var;
+ 	int	hostvarl = 0;
  
  	memcpy((char *) &sqlca, (char *) &sqlca_init, sizeof(sqlca));
  
***************
*** 569,575 ****
  			return false;
  
  		strcpy(newcopy, copiedquery);
! 		if ((p = next_insert(newcopy)) == NULL)
  		{
  
  			/*
--- 573,579 ----
  			return false;
  
  		strcpy(newcopy, copiedquery);
! 		if ((p = next_insert(newcopy+hostvarl)) == NULL)
  		{
  
  			/*
***************
*** 582,587 ****
--- 586,592 ----
  		else
  		{
  			strcpy(p, tobeinserted);
+ 			hostvarl = strlen(newcopy);
  
  			/*
  			 * The strange thing in the second argument is the rest of the
***************
*** 1227,1232 ****
--- 1232,1238 ----
  {
  	struct connection *con;
  
+ 	memcpy((char *) &sqlca, (char *) &sqlca_init, sizeof(sqlca));
  	if (strcmp(connection_name, "ALL") == 0)
  	{
  		for (con = all_connections; con;)