Hi, Valeria, A update that implements your suggestion has been checked into the SVN repository. Please give it a try when you get the chance.
You have two options to try: -- use the new version function ibis::table::dump that take two integer parameters. When you get a table as a result of a query, you will be invoking the concrete version from ibis::bord when you call this function. This option follows closely what you have suggested. -- use the command line tool ibis.cpp, you can now use two integers after the keyword limit, e.g., select a, b, where ... limit 3, 5 If you do get a chance to try it, please let us know if you encounter any problems. Thanks for the suggestion. John On 4/28/2010 1:17 PM, Valeria Lorenzetti wrote: > Hi John, > > I wanted to share with you a functionality that I added to my code and I > think could be very useful to other users of FastBit if introduced in > the library. > > Given my needs, I had to write my own function to print the rows that > matching the query conditions. Following the example of > ibis::bord::part::dump(), I rewrite my own function dump(). Instead of > use the LIMIT like in the original function, I added the ability to use > the LIMIT with the syntax similar to MySQL. > > In MySQL (http://dev.mysql.com/doc/refman/5.1/en/select.html), LIMIT > takes one or two numeric arguments. With two arguments, the first > argument specifies the index of the first row to return, and the second > specifies the maximum number of rows to return. The index of the initial > row is 0 (not 1): > > E.g. SELECT * FROM tbl LIMIT 5,10; # Retrieve rows 6-15 > > With one argument, the value specifies the number of rows to return from > the beginning of the result set: > > E.g: SELECT * FROM tbl LIMIT 5; # Retrieve first 5 rows > > > This feature becomes very useful for displaying large amounts of data. > In fact you can extract them in groups of <n> rows at once. It can be > very useful also if you use HTML pages to display the results: you can > spread the rows across pages using different LIMIT for each page: > > LIMIT 0,20 (first page) > LIMIT 20,20 (second page) > LIMIT 40,20 (third page) > and so on.. > > This could also be useful to examine the trend of results in the middle > of dataset, and not only for the first rows. > > > The change to be applied to the library to add this functionality I > think it could be very simple and could be something like this: > > ORIGINAL > int ibis::bord::part::dump(std::ostream& out, uint32_t nr, const char* del) > > NEW > int ibis::bord::part::dump(std::ostream& out, uint32_t start, uint32_t > offset, const char* del) > .. > > ORIGINAL > for (uint32_t i = 1; i < nr; ++ i) { > (void) clist[0]->dump(out, i); > ... > > NEW > /* No limit specified, all lines are printed */ > if (offset < 0) offset = nr_tot_rows; > > for (uint32_t i = start; i < start+offset && i < nr_tot_rows; ++ i) { > (void) clist[0]->dump(out, i); > ... > > > Let me know if you think it's a good idea and sorry for this endless email! > > Best regards, > Valeria Lorenzetti > > > > _______________________________________________ > FastBit-users mailing list > [email protected] > https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users _______________________________________________ FastBit-users mailing list [email protected] https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users
