Beispiel #1
0
INDEX LAYER::Save( PODBC odbc )
{
	if( !this )
		return INVALID_INDEX;
	if( iLayer && iLayer != INVALID_INDEX )
	{
		lprintf( WIDE("Recovering prior layer") );
		return iLayer;
	}

	{
		INDEX iStart = route_start_layer.layer->Save( odbc );
		INDEX iEnd = route_end_layer.layer->Save( odbc );
		INDEX iPeice;
		if( pLayerData )
			iPeice = pLayerData->peice->Save( odbc, iLayer, pLayerData->psvInstance );
		else
			iPeice = INVALID_INDEX;
		SQLInsert( odbc, WIDE("board_layer")
					  ,WIDE("x") , 2, x
					  ,WIDE("y"), 2, y
					  ,WIDE("min_x"), 2, min_x
					  ,WIDE("min_y"), 2, min_y
					  ,WIDE("width"), 2, w
					  ,WIDE("height"), 2, h
					  ,WIDE("linked_from_id"), 2, iStart
					  ,WIDE("linked_from_x"), 2, route_start_layer.x
					  ,WIDE("linked_from_y"), 2, route_start_layer.y
					  ,WIDE("linked_to_id"), 2, iEnd
					  ,WIDE("linked_to_x"), 2, route_end_layer.x
					  ,WIDE("linked_to_y"),  2, route_end_layer.y
					  ,WIDE("route"), 2, flags.bRoute
					  ,WIDE("peice_info_id"), 2, iPeice
					  ,WIDE("peice_type"), 1, pLayerData->peice->name() 
					  , NULL, 0, NULL );
		iLayer = FetchLastInsertID( odbc, NULL, NULL );
		lprintf( WIDE("Saved %lu"), iLayer );
	}

	if( flags.bRoute /*&& pds_path*/ )
	{
      INDEX idx;
      PLAYER_PATH_NODE path_node;
	  for( idx = 0; path_node = (PLAYER_PATH_NODE)PeekDataEx( &pds_path, idx ); idx++ )
		{
			SQLCommandf( odbc
				, WIDE("insert into board_layer_path(board_layer_id,x,y,fore,back)values(%lu,%ld,%ld,%d,%d)")
				, iLayer
				, path_node->x, path_node->y
				, path_node->flags.ForeDir, path_node->flags.BackDir );

		}
	}
   return iLayer;
}
Beispiel #2
0
	IMPORT INDEX Save( PODBC odbc, CTEXTSTR name_prefix, INDEX iParent, int bInput )
#ifdef BRAIN_SOURCE
	{
		TEXTCHAR name[MAX_NAME_LEN + 256];
		snprintf( name, sizeof( name ), WIDE("%s/%s"), name_prefix, c_name );
		SQLInsert( odbc
						, WIDE("brain_connectors") 
						, WIDE("connector_name"),1,name
						, WIDE("parent_id"),2,iParent
						, WIDE("input"),2,bInput
						, NULL, 0, NULL);
						return FetchLastInsertID(odbc,NULL,NULL); }