bool TransactionExecStatemachine_sqlite3::bind( std::size_t idx, const types::VariantConst& value)
{
	if (value.defined())
	{
		LOG_TRACE << "[sqlite3 statement] CALL bind( " << idx << ", '" << value << "', " << value.typeName( ) << " )";
	}
	else
	{
		LOG_TRACE << "[sqlite3 statement] CALL bind( " << idx << ", NULL)";
	}
	if (m_state != CommandReady && m_state != Executed)
	{
		return errorStatus( std::string( "call of bind not allowed in state '") + stateName(m_state) + "'");
	}

	try {
		m_statement->bind( idx, value );
		int rc = static_cast<SQLiteStatement *>( m_statement )->getLastStatus( );
		return status( rc, CommandReady );
	} catch( const std::runtime_error &e ) {
		return errorStatus( e.what( ) );
	}
	return true;
}
Ejemplo n.º 2
0
bool TdlTransactionFunctionClosure::InputStructure::print( ElementType type, const types::VariantConst& element)
{
	LOG_DATA << "[transaction input] push element " << langbind::InputFilter::elementTypeName( type) << " '" << utils::getLogString( element) << "'' :" << element.typeName( element.type());
	switch (type)
	{
		case langbind::TypedInputFilter::OpenTag:
			m_structure->openTag( element);
		break;
		case langbind::TypedInputFilter::CloseTag:
			m_structure->closeTag();
		break;
		case langbind::TypedInputFilter::Attribute:
			m_structure->openTag( element);
		break;
		case langbind::TypedInputFilter::Value:
			m_structure->pushValue( element);
			if (m_lasttype == langbind::TypedInputFilter::Attribute)
			{
				m_structure->closeTag();
			}
		break;
	}
	m_lasttype = type;
	return true;
}