Hi!

On Nov 01, Ian Collins wrote:
> So how do you use the HANDLER command in a C program?
> I perused the code for 3.2x for this, and ended up installing mysql-4.0.0.
> I found what I believe to be the code for HANDLER in
> libmysqld/sql_handler.cc
> in the functions,
> mysql_ha_open, mysql_ha_close, mysql_ha_read
> 
> Am I correct (or, as I surmise, off on a tangent)?

Actually it was supposed to be used standard way

mysql_connect();
mysql_query("HANDLER ... ");
...

It gives you benefits of using all the power of different MySQL
caches, and if you would later like to  move from ISAM to SQL logic
(that is to join tables in MySQL, not in application) you would be able
to reuse most of the code.

> Are there any examples anywhere of how to use these?
> 
> Many regards,
> Ian Collins.
> 
> -----Original Message-----
> From: Sergei Golubchik [mailto:[EMAIL PROTECTED]]
> Sent: Monday, October 15, 2001 11:49 AM
> To: Ian Collins
> Cc: [EMAIL PROTECTED]
> Subject: Re: Help - Migration to mysql from a legacy ISAM
> 
> 
> Hi!
> Actually, HANDLER command was created exactly for this.
> That is, it can be used for other purposes, of course,
> but the above transition is what it was created for.
> 
> See online manual.
> 
> On Oct 15, Ian Collins wrote:
> > I have a legacy Unix system (written in C) using an in-house ISAM database.
> > I am contemplating changing this syetm to use mysql (as well as it's
> > existing database) and want to know is anyone can give me tips in the
> > migration.
> >  
> > As you will see from the following, the code does fit very well with the SQL
> > structure.
> >  
> > The database we are using is relatively simple (but exceptionally fast!).
> > It is record based. Most of the database API routines will return a record
> > number in an ISAM file.
> >  
> > The 3 main database API routines below may give an insight into the database
> > use,
> >  
> > Routine 1 - This will match a record in an index, and return the record
> > number found. (Each database can have a number of indexes associated with
> > it).
> >  
> >     rec = kfind(logical_channel, string_to_match)
> >  
> > Routine 2 - This will return the next match in the index
> >  
> >     rec = knext(logical_channel)
> >  
> > Routine 3 - This will read a record from a logical database file (as
> > specified by the channel)
> >  
> >     result = readl(logical_channel, record_to_read, buffer)
> >  
> > The code (about 50Mb of legacy C code) contains numerous code segments such
> > as the following two code examples,
> >  
> > Example 1.
> >  
> > /* Loop though an index */
> >  
> > rec = kfind(chan, str);
> > process_record(rec);
> > while (rec >= 0) {
> >     rec = knext(chan);
> >     if (rec >= 0) process_record(rec);
> > }
> >  
> > Example 2.
> >  
> > /* Loop through an entire file */
> >  
> > for (rec=0; rec<last_rec(chan); rec++) {
> >     result = readl(chan, rec, buffer);
> >     ....
> > }
> >  
> > If anyone has been through this process before, or has any ideas on how to
> > do it, I would be very grateful. 
> >  
> > Many regards,
> > Ian Collins.
> >  
> 
> Regards,
> Sergei
> 
> -- 
> MySQL Development Team
>    __  ___     ___ ____  __
>   /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <[EMAIL PROTECTED]>
>  / /|_/ / // /\ \/ /_/ / /__  MySQL AB, http://www.mysql.com/
> /_/  /_/\_, /___/\___\_\___/  Osnabrueck, Germany
>        <___/
Regards,
Sergei

-- 
MySQL Development Team
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__  MySQL AB, http://www.mysql.com/
/_/  /_/\_, /___/\___\_\___/  Osnabrueck, Germany
       <___/

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to