Re: Re: [Rlib-devel] BIG NEWS

Shannon Weyrick <weyrick-UWl7u1r57vBWk0Htik3J/[email protected]>
Newsgroups gmane.text.rlib.user
Message-ID <[email protected]>
Hi Bob,

Ok, great. I wasn't sure how it was inititialized as I'm not all that 
familiar with glib.

I'm including another patch that's a little more adventurous. It allows 
retrieval of errors messages from the input source. As I only have mysql 
installed at the moment, the postgre and odbc input's don't actually 
return an error message. Comments welcome. Note, this patch is not 
against your latest release, but the one from last week.

So, although Roadsend's premier product is the compiler, we still do 
consulting and software development work. This project is a reporting 
engine for a school district that uses the SchoolMax system and various 
other data sources (as well as Roadsend SiteManager and Portal system).

Shannon

Bob Doan wrote:

>Hi 
>
>Thanks for the patch!
>
>I applied the patch minus the "r->queries_count = 0;" because the struct
>is bzero'd when its initialized.
>
>It also motivated me to fix a few other crashing situations if the
>actual query failed to run.
>
>Curiosity question.  What would php compiler folks be doing w/ RLIB?
>
>- bob
>  
>
error_msgs.diff (text/plain, 1.2 KB)
diff -r rlib-1.3.2/inputs/mysql/mysql.c rlib-1.3.2-weyrick/inputs/mysql/mysql.c
213a214,218
> static const gchar* rlib_mysql_get_error(gpointer input_ptr) {
> 	struct input_filter *input = input_ptr;
> 	return mysql_error(INPUT_PRIVATE(input)->mysql);
> }
> 
225a231
> 	input->get_error = rlib_mysql_get_error;
diff -r rlib-1.3.2/inputs/odbc/odbc.c rlib-1.3.2-weyrick/inputs/odbc/odbc.c
312a313,316
> static const gchar * rlib_odbc_get_error(gpointer input_ptr) {
> 	return "No error information";
> }
> 
325a330
> 	input->get_error = rlib_odbc_get_error;
diff -r rlib-1.3.2/inputs/postgre/postgre.c rlib-1.3.2-weyrick/inputs/postgre/postgre.c
175a176,179
> static const gchar * rlib_postgre_get_error(gpointer input_ptr) {
> 	return "No error information";
> }
> 
189a194
> 	input->get_error = rlib_postgre_get_error;
diff -r rlib-1.3.2/libsrc/api.c rlib-1.3.2-weyrick/libsrc/api.c
151c152
< 			rlogit("Failed To Run A Query [%s]\n", r->queries[i].sql);
---
> 			rlogit("Failed To Run A Query [%s]: %s\n", r->queries[i].sql, INPUT(r,i)->get_error(INPUT(r,i)));
diff -r rlib-1.3.2/libsrc/rlib_input.h rlib-1.3.2-weyrick/libsrc/rlib_input.h
50a51
> 	const gchar * (*get_error)(gpointer);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.