[firebird-support] Recursive lookup

2013-06-14 Thread nols_smit
Hi,

I created a recursive Sql query to lookup the nodes of a thread and where each 
node is classified according to a tree-structure (the variable Progress_Type_ID 
in the query  which is linked to ID, the primary key of the tree-structure 
Progress_Type).
The following SQL to do the recursive query:


/*--Bof query-*/
With Recursive
RecurseProgress as
(
 Select ID, Parent_ID, OldMines_ID, Progress_Type_ID, Progress_Type_Parent_ID, 
Progress_Type_Description,
 Instance_Date, Progress, 1 as ALevel from V_OldMines_Progress
   where Parent_ID is null
 Union all
 Select Child.ID, Child.parent_id, Child.OldMines_ID,  Child.Progress_Type_ID, 
Child.Progress_Type_Parent_ID,
 Child.Progress_Type_Description, Child.Instance_Date, Child.Progress, 
ALevel + 1 from V_OldMines_Progress Child 
  inner join RecurseProgress as CR1 on Child.parent_ID = CR1.ID
)
 
Select  * from RecurseProgress Pr
  Where Pr.OldMines_ID = :ID
 order by Pr.ID
/*-Eof query--*/
 
 
If I execute this query, ID is requested as the parameter
Now I want to modify it because Progress_Type_ID is also the primary key of a 
tree-structure and if I execute the modified query, it must ask for the two 
parameters, the current ID for the view V_OldMines_Progress  and the new 
starting point of the primary key of table Progress_Type.

I tried the following and then it asks for two parameters:
 ID_ROOTPRGRESSTYPE   and   ID (any value for ID_ROOTPRGRESSTYPE   have the 
same results):
 
/*-Bof query--*/ 
With Recursive
RecurseProgressType as
(
 Select ID from Progress_Type
   where ID = :ID_RootProgressType
 Union all
 Select TP.ID from Progress_Type TP, RecurseProgressType Parent
   where TP.Parent_ID = Parent.id
)
,
RecurseProgress as
(
 Select ID, Parent_ID, OldMines_ID, Progress_Type_ID, Progress_Type_Parent_ID, 
Progress_Type_Description,
 Instance_Date, Progress, 1 as ALevel from V_OldMines_Progress
   where Parent_ID is null
 Union all
 Select Child.ID, Child.parent_id, Child.OldMines_ID,  Child.Progress_Type_ID, 
Child.Progress_Type_Parent_ID,
 Child.Progress_Type_Description, Child.Instance_Date, Child.Progress, 
ALevel + 1 from V_OldMines_Progress Child , RecurseProgressType
  inner join RecurseProgress as CR1 on Child.parent_ID = CR1.ID
)
 
Select  * from RecurseProgress Pr
  Where Pr.OldMines_ID = :ID
 order by Pr.ID
/*-Eof query--*/


Any idea what I did wrorg?

Regards,

Nols Smit

Council for Geoscience, South Africa



RE: [firebird-support] Recursive lookup

2013-06-14 Thread Svein Erling Tysvær
Hi,

I created a recursive Sql query to lookup the nodes of a thread and where each 
node is classified according to a tree-structure (the 
variable Progress_Type_ID in the query  which is linked to ID, the primary key 
of the tree-structure Progress_Type).
The following SQL to do the recursive query:

/*--Bof query-*/
With Recursive
RecurseProgress as
(
 Select ID, Parent_ID, OldMines_ID, Progress_Type_ID, Progress_Type_Parent_ID, 
 Progress_Type_Description,
 Instance_Date, Progress, 1 as ALevel from V_OldMines_Progress
   where Parent_ID is null
 Union all
 Select Child.ID, Child.parent_id, Child.OldMines_ID,  Child.Progress_Type_ID, 
 Child.Progress_Type_Parent_ID,
 Child.Progress_Type_Description, Child.Instance_Date, Child.Progress, 
 ALevel + 1 from V_OldMines_Progress Child 
  inner join RecurseProgress as CR1 on Child.parent_ID = CR1.ID
)
 
Select  * from RecurseProgress Pr
  Where Pr.OldMines_ID = :ID
 order by Pr.ID
/*-Eof query--*/
 
If I execute this query, ID is requested as the parameter
Now I want to modify it because Progress_Type_ID is also the primary key of a 
tree-structure and if I execute the modified query, it must
ask for the two parameters, the current ID for the view V_OldMines_Progress  
and the new starting point of the primary key of table 
Progress_Type.

I tried the following and then it asks for two parameters:
 ID_ROOTPRGRESSTYPE   and   ID (any value for ID_ROOTPRGRESSTYPE   have the 
 same results):
 
/*-Bof query--*/ 
With Recursive
RecurseProgressType as
(
 Select ID from Progress_Type
   where ID = :ID_RootProgressType
 Union all
 Select TP.ID from Progress_Type TP, RecurseProgressType Parent
   where TP.Parent_ID = Parent.id
)
,
RecurseProgress as
(
 Select ID, Parent_ID, OldMines_ID, Progress_Type_ID, Progress_Type_Parent_ID, 
 Progress_Type_Description,
 Instance_Date, Progress, 1 as ALevel from V_OldMines_Progress
   where Parent_ID is null
 Union all
 Select Child.ID, Child.parent_id, Child.OldMines_ID,  Child.Progress_Type_ID, 
 Child.Progress_Type_Parent_ID,
 Child.Progress_Type_Description, Child.Instance_Date, Child.Progress, 
 ALevel + 1 from V_OldMines_Progress Child , RecurseProgressType
  inner join RecurseProgress as CR1 on Child.parent_ID = CR1.ID
)
 
Select  * from RecurseProgress Pr
  Where Pr.OldMines_ID = :ID
 order by Pr.ID
/*-Eof query--*/

Any idea what I did wrorg?

Hi Nols!

I don't quite get what you're trying to do, I'll guess, but feel free to 
reformulate your problem if my guessing is wrong. My guess is that you're 
trying to do, is to traverse two trees and join them together.

Maybe something like this will be appropriate:

/*-Bof query--*/ 
With Recursive
RecurseProgressType as
(
 Select ID from Progress_Type
   where ID = :ID_RootProgressType
 Union all
 Select TP.ID from Progress_Type TP
 Inner join RecurseProgressType Parent on TP.Parent_ID = Parent.id
)
,
RecurseProgress as
(
 Select ID, Parent_ID, OldMines_ID, Progress_Type_ID, Progress_Type_Parent_ID, 
Progress_Type_Description,
 Instance_Date, Progress, 1 as ALevel from V_OldMines_Progress
   where Parent_ID is null
 Union all
 Select Child.ID, Child.parent_id, Child.OldMines_ID,  Child.Progress_Type_ID, 
Child.Progress_Type_Parent_ID,
 Child.Progress_Type_Description, Child.Instance_Date, Child.Progress, 
ALevel + 1 from V_OldMines_Progress Child
  inner join RecurseProgress as CR1 on Child.parent_ID = CR1.ID
)
 
Select  * from RecurseProgress Pr
Inner join RecurseProgressType RPT on Pr.ProgressTypeID = RPT.ID
  Where Pr.OldMines_ID = :ID
 order by Pr.ID, RPT.ID
/*-Eof query--*/

HTH,
Set


[firebird-support] Fluxo do software

2013-06-14 Thread Fabiano Kureck
Tenho algumas dúvidas quanto ao fluxo dos softwares:

 

A princípio se usa um programa CAD (AutoCad, Solidworks, etc) para gerar o
arquivo 3D .stl certo? 

Após isso se passa para no netfabb para que o arquivo stl seja
preparado/compatível com uma impressão 3D.

Então, passa-se pelo Slickr (algo assim) que pega o arquivo STL e gera um
GCODE. Nesse GCODE existem as 

fatias de impressão que contém a espessura de cada uma, temperatura do hot
end para cada fatia, velocidade

do cooler e etc. É isso?

 

Por fim, o Slickr manda o GCODE para o repetier host que é instalado no PC,
que passa pelo cabo usb/rs232

para o Repetier (marlin, etc) na placa Gen7BR/RAMPS/Sethi3d para que o
Repetier movimente os motores de 

passo.

 

Estou certo em meu raciocínio?



[Non-text portions of this message have been removed]



Re: [firebird-support] Fluxo do software

2013-06-14 Thread Alexandre Benson Smith
Em 14/6/2013 08:22, Fabiano Kureck escreveu:
 Tenho algumas dúvidas quanto ao fluxo dos softwares:

   

 A princípio se usa um programa CAD (AutoCad, Solidworks, etc) para gerar o
 arquivo 3D .stl certo?

 Após isso se passa para no netfabb para que o arquivo stl seja
 preparado/compatível com uma impressão 3D.

 Então, passa-se pelo Slickr (algo assim) que pega o arquivo STL e gera um
 GCODE. Nesse GCODE existem as

 fatias de impressão que contém a espessura de cada uma, temperatura do hot
 end para cada fatia, velocidade

 do cooler e etc. É isso?

   

 Por fim, o Slickr manda o GCODE para o repetier host que é instalado no PC,
 que passa pelo cabo usb/rs232

 para o Repetier (marlin, etc) na placa Gen7BR/RAMPS/Sethi3d para que o
 Repetier movimente os motores de

 passo.

   

 Estou certo em meu raciocínio?





Two things

This is an internation list, so you should write in English, this list 
is about Firebird (RBDMS) and has no relation with your doubts regarding 
CAD/CAM systems.

Perhaps you post to the wrong list.

Good luck !


Duas coisas...

Esta é uma lista internacional e deve postar em ingles aqui.. outra 
coisa, esta lista é sobre Firebird, um gerenciador de banco de dados 
open source e não tem relação alguma com a tua duvida que é sobre CAD/CAM.

Deve ter postado em lista errada...

boa sorte !





RES: [firebird-support] Fluxo do software

2013-06-14 Thread Fabiano Kureck
Sorry about that!

I posted on wrong place...



[Non-text portions of this message have been removed]