From: Bob D. <bd...@si...> - 2004-07-02 18:36:31
|
Hi, In c here's how it works As you know RLIB support Mysql, postgresql, and ODBC (allowing like 20 other data sources) RLIB does this w/ an "input class" filter Here's the struct/class struct input_filter { gpointer private; struct input_info info; gint (*input_close)(gpointer); gpointer (*new_result_from_query)(gpointer, gchar *); gint (*free)(gpointer); gint (*first)(gpointer, gpointer); gint (*next)(gpointer, gpointer); gint (*previous)(gpointer, gpointer); gint (*last)(gpointer, gpointer); gint (*isdone)(gpointer, gpointer); gchar * (*get_field_value_as_string)(gpointer, gpointer, gpointer); gpointer (*resolve_field_pointer)(gpointer, gpointer, gchar *); void (*free_result)(gpointer, gpointer); gint (*set_encoding)(gpointer); }; The second part of the magic is having a "query" or some real filter on the data set that the input_filter operates on. There is typically a 1 to N relationship between the input_filter and the queries. Also, RLIB has a lot of "object oriented" code, even though it is C.. so almost all functions in this input_filter class take a "this" pointer.. Other functions take a "this" pointer and a pointer to a result set Most of the function are obvious, and if you look at mysql.c or postgres.c you can see how they are implemented.. Basically inside rlib the normal chain of events are: 1) Open the input_filter.. this is typically a custom job, and is done differently for all databases.. so it's up to you to do it.. and in the private * part of the input_filter hold connection info and other crap you care about. 2) Pass it all the queries and *new_result_from_query will return a pointer to A result set 3) RLIB compiles the XML into PCODE and resolves all fields from the XML to the datasource/result sets. The function *resolve_field_pointer takes a char * field name and turns it into a direct access/ almost direct access pointer. In MYSQL the name gets turned into a col number. In postgresql it gets turned into a field pointer. 4) RLIB spins in a loop through the main loop query.. basically.. First the "first" function is called, then it keeps calling "next" until the "isdone" function returns TRUE. WATCH OUT: When RLIB hits a break it got there by calling NEXT and seeing if things no longer match. But RLIB will go PREVIOUS 1 row so that the break footer fields reflect the correct row (Most Reporting Engines don't do this BTW) So you will need to keep at least a ONE ROW CACHE as you spin though your data set. Postgresql makes this easy, MySQL is kinda easy, ODBC is not.. you have to do it your self. 5) *free_result is called for all the queries. input_close is called, then free is called (free your private stuff here) All Done. Here's what I don't know 1) In PYTHON once it calls a "c" function can the "c" function go back out and call a "python" function. DO YOU KNOW? 2) I know SICOM has no plans to do this sorta PYTHON work for free (as we currently don't need it and no one has offered to pay) If you are of the paying type and you want to use RLIB commercially then let me know and I'll look into how long it would take me or Chet - bob On Fri, 2004-07-02 at 15:54 +0000, Farryp Philippe-Auguste wrote: > Pls, > send me the info. > > How long will it take to write a python binding to support this option for > python ? > > best regards > > Farry > > > Bob Doan (bd...@si...) wrote: > > > > Yes, > > > > We (SICOM) Do some of the same things w/ one of our particular projects. > > However, you need to use C. If your C is good then I'll explain a bit > > more how it works > > > > - bob > > > > On Thu, 2004-07-01 at 22:37 +0000, Farryp Philippe-Auguste wrote: > > > Hi, > > > > > > I'm wondering if there is a way to pass data to rlib without using a > > > datasource. > > > > > > I'm using a replication system so I do not connect to a particular database. > > > > > > Is there is a way of instead of using rlib_add_datasource... and > > > rlib_add_query_as, > > > > > > can I instead of having a select statement , having a variable which contains > > > the data that I need RLIB to populate ? I will use my own libraries to get > > > the data from the database. > > > > > > > > > Thanks > > > > > > farry > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.Net email sponsored by Black Hat Briefings & Training. > > > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - > > > digital self defense, top technical experts, no vendor pitches, > > > unmatched networking opportunities. Visit www.blackhat.com > > > _______________________________________________ > > > Rlib-users mailing list > > > Rli...@li... > > > https://lists.sourceforge.net/lists/listinfo/rlib-users > > > > > > > > ------------------------------------------------------- > > This SF.Net email sponsored by Black Hat Briefings & Training. > > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - > > digital self defense, top technical experts, no vendor pitches, > > unmatched networking opportunities. Visit www.blackhat.com > > _______________________________________________ > > Rlib-users mailing list > > Rli...@li... > > https://lists.sourceforge.net/lists/listinfo/rlib-users > > > > > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & Training. > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - > digital self defense, top technical experts, no vendor pitches, > unmatched networking opportunities. Visit www.blackhat.com > _______________________________________________ > Rlib-users mailing list > Rli...@li... > https://lists.sourceforge.net/lists/listinfo/rlib-users |