Hello All,

This maybe a brain-dead C++ programmer error (I am a bit rusty :-/) but I have 
been working the last day on a C++ compile error for the last day or so and 
hoping someone else has ran and solved a similar situation.  The error I am 
getting is: "error: ‘into’ was not declared in this scope" and involves the 
into clause of a statement prepare call.  I can get a similar construct to work 
fine in a simple stand-alone program but not in the real code I am working on.  
I hope I can explain this well enough.

The code I can not get to work is this:

DbSqliteDirectory::DbSqliteDirectory(std::string path)
{
    m_db_session = openDb(path);

    // Begin TEST!! JRD
    m_prep_get_version = new soci::statement((m_db_session->prepare <<
        "select version from version", into(m_version_rec)));
    m_prep_get_version->execute(false);

    while (m_prep_get_version->fetch())
    {
        std::cout << "Version: " << m_version_rec << std::endl;
    }

m_prep_get_version is defined in a class which DbSqliteDirectory is a subclass 
as:

 soci::statement* m_prep_get_version;

m_db_session is also defined in a class which DbSqliteDirectory is a subclass 
as:

soci::session* m_db_session;

BTW this session works when I use non-prepared statements with rowset and row.

m_version_rec is also defined in a class which DbSqliteDirectory is a subclass 
as:

std::string m_version_rec;

BTW I have tried using local method variables for the into() target but get the 
same error.

Now I have slowly built up a stand-alone program that simulates what I want to 
do and it WORKS.  See the attached file.  Notice this uses the same class 
hierarchy, use of pointers, protected class variables, and include files as the 
real-code.

I am using the 5105f0f version of Soci.

I am totally lost on this one.  I am hoping someone has run into a similar 
situation and has an easy fix :-).

Thanks for any help (I hope I am not being too much of a pain :-( ).

John


      
::::::::::::::
testPrep6A.h
::::::::::::::
#include <soci.h>
#include <statement.h>
#include <sqlite3/common.h>
#include <sqlite3/soci-sqlite3.h>
#include <iostream>
#include <istream>
#include <ostream>
#include <string>
#include <exception>

using namespace soci;
using namespace std;

class Db
{
public:
    Db();

protected:
    session* sql;
    statement* prepStatement;
    string     workString;
};

::::::::::::::
testPrep6B.h
::::::::::::::
#include "testPrep6A.h"

class Db2: public Db
{
public:
    Db2();
};

::::::::::::::
testPrep6A.cpp
::::::::::::::
#include "testPrep6B.h"

Db::Db()
{
}

int main()
{
    Db2 db2;

}
::::::::::::::
testPrep6B.cpp
::::::::::::::
#include "testPrep6B.h"

Db2::Db2()
{
    sql = new session(sqlite3, "Directory.sqlite");
    prepStatement = new statement((sql->prepare << 
        "select version from version", into(workString)));

    prepStatement->execute();

    while (prepStatement->fetch())
    {
        cout << "Version: " << workString << endl;
    }
}
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to