function TPlanet.FindCometName(comname: String; var ra,de,mag:double; cfgsc: Tconf_skychart; upddb:boolean; MeanPos:boolean=false):boolean; var dist,r,elong,phase,rad,ded : double; epoch,h,g,ap,an,ic,ec,eq,tp,q,diam,lc,car,cde,rc,xc,yc,zc : double; qry,id,nam,elem_id,s1,s2 :string; i,ira,idec,imag: integer; begin result := false; searchid := ''; if (not db1.Active) or (not cfgsc.ephvalid) then exit; s1 := UpperCase(trim(comname)); if s1 = '' then exit; id := ''; qry := 'SELECT id FROM cdc_com_name' + ' where name like "' + s1 + '"'; db1.Query(qry); if db1.RowCount > 0 then id := db1.QueryOne(qry); if id = '' then begin qry := 'SELECT id FROM cdc_com_name' + ' where name like "%'+ s1 +'%"' + ' limit 1'; db1.Query(qry); if db1.RowCount > 0 then id := db1.QueryOne(qry); end; if id = '' then exit;