See Also
You are here: Interfacing > C++ Client Interface > Examples C++ Client Interface > Simple Query
ContentsIndexHome
PreviousUpNext
Simple Query
Scdriver Example

 

Simple Query 

Connects to the database, runs a query. This program will simply run the GENERATE STATISTICS SQL command. 

This needs to be linked against scdriver.lib and run with scdriver.dll available. 

 

// Visual Studio added
#include "stdafx.h"

#include "scdriver.h"
#include <iostream>

int main(int argc, char** argv)
{
    CConnection conn;
    try
    {
        // Connect to the local machine on the default port
        conn.Connect("localhost",999);
        // Execute a query
        conn.Execute("GENERATE STATISTICS FOR ALL");
        // Must be called after every query to finish the query status
        conn.GetCompletionStatus();
    }
    catch (node_exception& e)
    {
        std::cerr << "Error: " << e.msg << std::endl;
        return 1;
    }
    return 0;
}

 

 

Related