[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Mysql c api doubt

Posted on 2004-03-20
1
Medium Priority
?
276 Views
Last Modified: 2010-04-15
Hi experts,

       I am writing a c program using mysql api. My mysql program is returning the output like


 col1          col2                    col3                  col4                                            col5

 
  1  ||    20040319092354 ||    37   ||    Application Error Notification    ||       Relevant line :<META

  2  ||    20040319092356 ||    30   ||    Application Error note            ||       Relevant line2 :<META


and so  on upto 'n' rows..........




I want the output to be in form


col1:::1  col2:::20040319092354  col3:::37  col4:::Application Error Notification   col5:::Relevant line :<META (eol)
col1:::1  col2:::20040319092354  col3:::37  col4:::Application Error Notification   col5:::Relevant line :<META (eol)


thus 30 rows........

Please give me idea ( preferrably code snippet) to do this......
Early responses are greatly appreciated.....


Warm regards

NP

0
Comment
Question by:msanoop
1 Comment
 
LVL 9

Accepted Solution

by:
ankuratvb earned 750 total points
ID: 10642998
Borrowing code from ur other thread:

if (result = mysql_store_result(mysql))
   {
      for(r=0;r<=mysql_field_count(mysql);r++)
       {
          row=mysql_fetch_row(result);
          if(row<0) break;
          for(t=0;t<mysql_num_fields(result);t++)
            {
                  printf("Col:%d:::%s  ",t+1,row[t]);
            }
          printf("\n");
       }
    }
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question