List:MySQL++« Previous MessageNext Message »
From:Paoletti Vincenzo Date:August 31 2005 9:38am
Subject:SSQL:sql_create_x(...)
View as plain text  
Hi,
I've tried to use the sql_create_x(...) like example posted but the compiler gets a lot of errors:
ERRORS:
make: Making C++ object test_mysql_main.o ...
test_mysql_main.cpp:15: parse error before numeric constant
test_mysql_main.cpp:15: parse error before numeric constant
test_mysql_main.cpp:15: missing ';' before right brace
test_mysql_main.cpp: In member function `void stock::set(...)':
test_mysql_main.cpp:15: `p1' undeclared (first use this function)
test_mysql_main.cpp:15: (Each undeclared identifier is reported only once for 
   each function it appears in.)
test_mysql_main.cpp:15: `p2' undeclared (first use this function)
test_mysql_main.cpp:15: `p3' undeclared (first use this function)
test_mysql_main.cpp:15: `p4' undeclared (first use this function)
test_mysql_main.cpp:15: `p5' undeclared (first use this function)
test_mysql_main.cpp: At global scope:
test_mysql_main.cpp:15: extraneous `char' ignored
test_mysql_main.cpp:15: array size missing in `names'
test_mysql_main.cpp:15: non-member function `
   stock_value_list<mysqlpp::quote_type0> value_list()' cannot have `const' 
   method qualifier
test_mysql_main.cpp: In function `stock_value_list<mysqlpp::quote_type0> 
   value_list()':
test_mysql_main.cpp:15: conversion from `mysqlpp::value_list_b<char[2], 
   mysqlpp::do_nothing_type0>' to non-scalar type `
   stock_value_list<mysqlpp::quote_type0>' requested
test_mysql_main.cpp: At global scope:
.........   

CODE:
#include <mysql++.h>
#include <custom.h>

#include <iostream>
#include <iomanip>
#include <vector>

#include "test_mysql_main.h"
using namespace std;
using namespace mysqlpp;

sql_create_3(stock,1, 5,int,num,int, weight,int, price);


int main()
{
    try {
        	Connection con(use_exceptions);
	con.connect("sam_db", "localhost", "root","");

        // Get all the rows in the stock table.
        Query query = con.query();
        query << "select * from db_profili_saefon";
        vector<stock> res;
        query.storein(res);

        if (res.size() > 0) {
            // Build a select query using the data from the first row
            // returned by our previous query.
            /*
			query.reset();
            query << "select * from stock where " <<
                res[0].equal_list(" and ", stock_weight, stock_price);
			*/
            // Display the finished query.
            cout << "Custom query:\n" << query.preview() << endl;
        }

        return 0;
    }
    catch (BadQuery& er) {
        // Handle any connection or query errors
        cerr << "Error: " << er.what() << endl;
        return -1;
    }
    catch (BadConversion& er) {
        // Handle bad conversions
        cerr << "Error: " << er.what() << "\"." << endl <<
                "retrieved data size: " << er.retrieved <<
                " actual data size: " << er.actual_size << endl;
        return -1;
    }
    catch (exception& er) {
        // Catch-all for any other standard C++ exceptions
        cerr << "Error: " << er.what() << endl;
        return -1;
    }
}


**********************************************************************
The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this message
by anyone else is unauthorized. If you are not the intended recipient, any
disclosure, copying, or distribution of the message, or any action or
omission taken by you in reliance on it, is prohibited and may be unlawful.
Please immediately contact the sender if you have received this message in
error.

**********************************************************************
Thread
SSQL:sql_create_x(...)Paoletti Vincenzo31 Aug
  • Re: SSQL:sql_create_x(...)Warren Young1 Sep