[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-developer
Subject:    Re: Compiled code doesn't work/general suggestiontions wtd
From:       Michael Widenius <monty () monty ! pp ! sci ! fi>
Date:       1999-06-29 3:18:44
[Download RAW message or body]

>>>>> "Sasha" == Sasha Pachev <sasha@direct1.com> writes:

Sasha> Michael Ferdman wrote:
>> 
>> I am currently developing a rather large package which involves a
>> database.  Because mysql is by far the best candidate for the job, it was
>> selected as the database for this project.  A minor problem is in the fact
>> that stored procedures are not implemented.  I basically only need 1
>> procedure in this entire database, which when called with certain
>> parameters will perform the following basic function:
>> UPDATE master WHERE a=id
>> UPDATE table1 WHERE a=id
>> if AFF_ROWS==0 then INSERT INTO table1 (a) VALUES(id)
>> UPDATE table2 WHERE a=id
>> if AFF_ROWS==0 then INSERT INTO table2 (a) VALUES(id)
>> UPDATE table3 WHERE a=id
>> UPDATE table4 WHERE a=id
>> now, this is fairly straight forward (the reson why I have the 2
>> UPDATE/INSERT pairs is because I need to do a count=count+value SET in the
>> update, or simply insert the "value" with its id if it is not yet in the
>> table)...
>> I've decided to simply add another set of rules into the sql parser and
>> define another SQLCOM_ which would perform all the necessary operations.
>> My first question is if mainly for opinions and suggestions on how to do
>> this,perhaps better, than I currently plan.
>> The next question I have is much much simpler...  If i just grab the mysql
>> source distribution (.23b) it does not regenerate new sql_yacc.cc and
>> sql_yacc.h files properly.  After editing the Makefile in sql/ and
>> changing sql_yacc.hh to sql_yacc.h, bison runs ok and everything compiles
>> fine.  I install the newly linked mysqld, run it - everything looks ok.
>> After this I launch the mysql client, connect, but any query I send to the
>> database results in a "SQL syntax error on line 1".  I will be looking
>> into this again later tonite, any suggestions as to why this is happening
>> are welcome...
>> 

Sasha> I had a similar problem, only it was the function that I added that did
Sasha> not work. To debug the code, I added fprintf(stderr, stuff) in
Sasha> sql_yacc.yy and sql_lex.cc in the places where I suspected the problem.
Sasha> Then I recompiled and ran sql/mysqld&, connected to mysql from another
Sasha> terminal window, and ran some queries. I could see the debugging output
Sasha> in the original window. There is probably a better way to do it, but for
Sasha> my problem this hack was good enough. Maybe Monty can share with us what
Sasha> debugging methods he is using - the "official" way to debug your own
Sasha> MySQL development.

You should use the DBUG package for this.

Check out the documentation in dbug/dbug.c!

This is a extremely flexible package.  This nice thing with this is
also that if you don't configure '--with-debug', the debugging code
will not be included in the final binary.

To use the package, you just start mysqld with:

mysqld --debug

To get a nice trace file in /tmp/mysql.trace

Regards,
Monty

---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail developer-thread113@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail developer-unsubscribe@lists.mysql.com instead.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic