Pro-E numeric codes cover most components, but parts downloaded as STEP from online catalogs (rings, bushings, knobs...) get alphabetic Creo names with no predictable shape. Add a second extraction path that tokenizes the binary generically and validates candidates against the known codes in cad_index.db, applying the same placement/occurrence rule used for bare numeric codes. Numeric extraction is unchanged, so missing-from-index reporting for renamed/moved Pro-E codes still works. Also load all known prt/asm codes once per scan instead of one query per candidate, in both RisolviAlberoComponenti and VerificaCompletezzaAssiemi. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
19 lines
632 B
C#
19 lines
632 B
C#
#:package Microsoft.Data.Sqlite@10.0.12
|
|
// dotnet run scripts/Query.cs -- <cad_index.db> <sql>
|
|
using Microsoft.Data.Sqlite;
|
|
|
|
using var connection = new SqliteConnection($"Data Source={args[0]};Mode=ReadOnly");
|
|
connection.Open();
|
|
using var command = connection.CreateCommand();
|
|
command.CommandText = args[1];
|
|
using var reader = command.ExecuteReader();
|
|
int righe = 0;
|
|
while (reader.Read())
|
|
{
|
|
righe++;
|
|
var valori = Enumerable.Range(0, reader.FieldCount).Select(i => reader.IsDBNull(i) ? "" : reader.GetValue(i).ToString());
|
|
Console.WriteLine(string.Join(" | ", valori));
|
|
}
|
|
Console.WriteLine($"({righe} righe)");
|
|
return 0;
|