View | Details | Raw Unified | Return to bug 89308
Collapse All | Expand All

(-)mysql.c (-7 / +30 lines)
Lines 76-91 Link Here
76
76
77
	if( cfg->DBHandle ) {
77
	if( cfg->DBHandle ) {
78
78
79
		retval = mysql_query(( MYSQL * )cfg->DBHandle, query );
79
		//
80
		// loop for handling multiple SQL 
81
		char* new_query;
82
		char* end_;
83
		char* copy_query = malloc(strlen(query)+1);
84
		
85
		(void) strcpy (copy_query, query);
86
		
87
		end_ = copy_query - 1;
88
		
89
		do {
90
		    
91
		    new_query = end_ + 1; 
92
		    
93
		    // locate occurance of ';'
94
		    end_ = strchr( new_query, ';' );
95
		    
96
		    if (end_) *end_ = 0;
97
		    
98
		    retval = mysql_query(( MYSQL * )cfg->DBHandle, new_query );
80
99
81
		if( retval ) {
100
		    if( retval ) {
82
101
83
			ap_log_error( APLOG_MARK,ERRLEVEL, server, 
102
			    ap_log_error( APLOG_MARK,ERRLEVEL, server, 
84
						  ap_pstrcat( p, "MySQL insert failed:  ", query, NULL ));
103
						    ap_pstrcat( p, "MySQL insert failed:  ", query, NULL ));
85
104
86
			ap_log_error( APLOG_MARK, ERRLEVEL, server, 
105
			    ap_log_error( APLOG_MARK, ERRLEVEL, server, 
87
						  ap_pstrcat( p, "MySQL failure reason:  ", MYSQL_ERROR( cfg->DBHandle ), NULL ));
106
						    ap_pstrcat( p, "MySQL failure reason:  ", MYSQL_ERROR( cfg->DBHandle ), NULL ));
88
		}
107
		    }
108
		
109
		} while ( end_ );
110
		
111
		free( copy_query );
89
	}
112
	}
90
113
91
	signal( SIGPIPE, handler );
114
	signal( SIGPIPE, handler );

Return to bug 89308