Valentina Client 2.0 - C++

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Mar 8 21:54:50 CST 2004


On 3/8/04 9:32 PM, "David Nock" <davidn at accessitsoftware.com> wrote:

Hi David,

> I've got as far as getting a connection to the database but as soon as I try
> ExecuteSQL it throws an exception. Is there a way to detect why the
> exception was thrown?

You work on Windows, with C++ and Vserver a60, yes?
Also I recommend to use Valentina Studio.

Also I recommend to run Valentina Server from console window to see output.
Read docs about this.

Also it is recommended to use VerboseLevel = 3 in the ini file
During development.
 

> I tried compiling a debug version of the client but there was not debug
> precompiled header file.
> 
> // in my constructor I have this, which succeeds i.e. Doesn't throw and
> exception
> 
>   szHost = _T("127.0.0.1");
>   szPort = _T("15432");
>   szUsername = _T("sa");
>   szPassword = _T("sa");
>   szDatabase = _T("V8Test");
> 
>   VDK_DataBase::InitStaticMembers();
>   //MakeDataBaseCache( 3*1024*1024 );//can't call this-no implementation
>   ValentinaInit( 3*1024*1024 );

Use simply ValentinaInit().
No need for InitStaticMembers()


>   myDB = new VDK_DataBase(szHost.c_str(), szUsername.c_str(),
> szPassword.c_str());
>   try
>   {
>       myDB->OpenDataBase(szDatabase.c_str());

So you try to open EXISTED database under Valentina Server?
Have you register that database by Valentina Studio?
Or you have create this database?
I.e. How you are sure that Vserver know about db "V8Test"?

I see that later you try CREATE TABLE.
So do you have database already under server?
May be you need at first call db->CreateDatabase()?

>   }
>   catch(...)
>   {
>       wxMessageBox("Unable to open database.");
>   }



> // then in a button event I have
> 
> bool MyFrame::RunQuery(wxString szQuery)
> {
>   VDK_Cursor* mCursor;
>   ulong err = 0;
>   mCursor = new VDK_Cursor( myDB );
>   try
>   {
>       err = mCursor->ExecuteSQL( "CREATE TABLE _Preferences(fldBoolean
> boolean)" );
>   }
>   catch(...)
>   {
>       wxMessageBox("Error executing SQL.");
>   }
>   //listWebDiffs->Append(szQuery);
>   //listWebDiffs->Append(wxString::Format("%ld",err));
>   ForgetObject( mCursor );
>   return (err == 0);
> }
> 
> It always throws the error 'Error executing SQL' and err is 0;
> 
> Do you have any ideas?

Better use the next form:

bool MyFrame::RunQuery(wxString szQuery)
{
    VDK_Cursor* mCursor;
    ulong err = 0;

    try
    {
        char* query = "CREATE TABLE _Preferences(fldBoolean boolean)"
        mCursor = mDB->ExecuteSql( query );
    }
    catch( FBL_Exception& e )
    {
        err = e.GetErrorCode();
        wxMessageBox("Error executing SQL.");
    }

    ForgetObject( mCursor );
    return (err == 0);
}





-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list