Hi Steven,

This is a pretty rough example. I have my own sqlite wrapper but this could
give you an idea:

if( nCount > 0 )
        {
                nRetBegin = m_sql.Exec( "BEGIN;", &szError );

                for(INT i=0;i<nCount;i++)
                {
                        Codepage cpInfo = m_aCodepages.GetAt( i );

                        strQuery.Format( _T("UPDATE codepages SET isBlocked
= %d WHERE characterSetName = '%s';"),
        
cpInfo.nIsBlocked, cpInfo.szCharacterSetName );

                        nRet = m_sql.Exec( strQuery, &szError );
                        nRows = m_sql.Changes();
                }

                if( !nRetBegin )
                        nRet = m_sql.Exec( "COMMIT;", &szError );
        }

Regards,

 
Luc Vandal
Edovia Technologies Inc.
www.edovia.com
[EMAIL PROTECTED]

-----Original Message-----
From: steven frierdich [mailto:[EMAIL PROTECTED] 
Sent: May 12, 2005 5:41 PM
To: [email protected]
Subject: Re: [sqlite] BEGIN & COMMIT: useful for SELECT?

Does anyone have any sample code on doing transactions in sqllite, and 
know of a website where
I can read up oh how transactions work?
Thanks
Steve

D. Richard Hipp wrote:

>On Thu, 2005-05-12 at 15:19 -0400, Luc Vandal wrote:
>  
>
>>are transactions only useful
>>for when we're writting or updating the database? 
>>    
>>
>
>Transactions are also useful when you do
>multiple SELECTs and you want to be sure
>that no other process changes the database
>in the between two of your SELECTs.
>  
>


Reply via email to