Results 1 to 6 of 6

Thread: Can I use MySQL API for C++?

  1. #1
    Join Date
    Aug 2006
    Posts
    287

    Can I use MySQL API for C++?

    I am working on a project which requires the linking of the programing language with the database. I am having better knowledge about the C and C++ programming language. Also I know bit of PHP and Java, but I think I have good knowledge of C/C++. If anyone tell me some API or library files for linking with the programing language will be really grateful for me. Also I want to know that Can I use MySQL API for C++.?? Please help me soon..!!
    Dimension 1100 (FMY032J) mini-tower
    2.53ghz Intel Pentium 4
    80 gig nfts HDD
    512 RAM
    Main circuit board: Dell 0CF458
    BIOS: Dell A00
    Display: Intel(R) 82865G Graphics Controller [Display adaptor]
    Multimedia: Sound MAX Integrated Digital Audio
    Windows XP Home SP2

  2. #2
    Join Date
    Jul 2006
    Posts
    289

    Re: Can I use MySQL API for C++?

    You can surely use MySQL API for C++ which is known as mysqlcppapi. mysqlcppapi is a C++ wrapper for the MySQL C API library. I would like to tell you the strong points of the MySql++ project :
    • Instead of deciding on an interface, MySQL++ provides too many ways to do things which proves as an obscures for the design.
    • Speed is the main feature of the MySQL++, you can say that MySQL++ is aggressively optimised for speed. The only thing is that once your design is matured then only optimisation should happen and that should be targeted. Premature optimisation obscures the design and prevents it from improving.
    • Also MySQL++ uses preprocessor macros to an extent that is unacceptable in a C++ library.
    Signatures reduce available bandwidth

  3. #3
    Join Date
    Nov 2008
    Posts
    1,192

    Re: Can I use MySQL API for C++?

    There are some new functionality, which are included in library of MySQL++. Some of the functionality are as follows :
    1. The FieldInfo::sql() method will prepare a field value for a MySQL query.
    2. The FieldInfo class can generate the text needed to create a field in a MySQL query.
    3. The Connection can supply a list of tables and the field information for any table.
    You can also download this application from the Web.

  4. #4
    Join Date
    Nov 2008
    Posts
    996

    Re: Can I use MySQL API for C++?

    You can use the MySQL C++ Wrapper which is a set of C++ classes for working with the MySQL library. So the answer is you can use MySQL API for C++. Here is the coding for that :
    Code:
    #include "mysqlplus.h"
    #include <STDIO.H>
    
    void main()
    {
       sql_connection_c connection( "database", 
               "localhost", "root", "mypassword" );
       sql_query_c query( &connection );
       sql_result_c *sql_result = 0;
       if ( !query.execute( "select * from customers" ) )
       {
          printf( "oops... didn't execute!!\n" );
          return;
       }
       sql_result = query.store();
       int n_fields = sql_result->n_fields();
       for ( int idx = 0; idx < n_fields; idx++ )
       {
          sql_field_c sql_field = sql_result->fetch_field( idx );
          printf( "field %d [%s]\n", idx, sql_field.get_name() );
       }
    }

  5. #5
    Join Date
    Mar 2008
    Posts
    349

    Re: Can I use MySQL API for C++?

    I think that for running the program mentioned by the 'CodGuru' you will require the download of MySQL headers and library files. If you want to build your own binary RPMs, then you will have to run the following command as root :
    Code:
    # rpmbuild --rebuild /wherever/it/is/mysql++-3.0.9-1.src.rpm
    MySQL++ should work on any platform that has a Standard C++ compiler and the MySQL C API development files. Also MySQL++ works best with MySQL version 4.1 or higher. MySQL++ is free software, licensed under the GNU LGPL. MySQL works out of the box with Visual C++ 2005 and 2008.

  6. #6
    Join Date
    Mar 2008
    Posts
    672

    Re: Can I use MySQL API for C++?

    MySQL builds under Solaris and under Borland C++ Builder. The only major feature that doesn’t work out of the box is the Specialized SQL Structures. It can’t work as-is due to a compiler limitation. To build any program using MySQL++, at minimum you must link to the MySQL++ library and also to the MySQL C API library that MySQL++ is built upon. The current version of MySQL++ has no known memory leaks. In MySQL++, the main user-facing classes are mysqlpp::Connection, mysqlpp::Query, mysqlpp::Row, mysqlpp:toreQueryResult, and mysqlpp::UseQueryResult.

Similar Threads

  1. Replies: 4
    Last Post: 13-01-2011, 01:08 AM
  2. What are API in MySQL?
    By Atsushi in forum Software Development
    Replies: 3
    Last Post: 16-12-2010, 02:57 AM
  3. mysql config file in MySQL
    By Netorious in forum Software Development
    Replies: 4
    Last Post: 18-03-2010, 09:43 PM
  4. Replies: 3
    Last Post: 07-11-2009, 09:36 PM
  5. MySQL with PHP
    By Gyan Guru in forum Guides & Tutorials
    Replies: 2
    Last Post: 18-11-2008, 04:53 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,566,434.59645 seconds with 16 queries