Premiere commit - Omika

This commit is contained in:
2026-10-23 18:46:50 +02:00
commit 8ea76c1b24
2155 changed files with 984301 additions and 0 deletions
@@ -0,0 +1,21 @@
using System.Text.RegularExpressions;
namespace Omika.HfSqlProbe;
internal static partial class SqlIdentifierValidator
{
/// <summary>Accepts only letters, digits, and underscores.</summary>
[GeneratedRegex(@"\A[A-Za-z_][A-Za-z0-9_]*\z")]
private static partial Regex IdentifierPattern();
public static bool IsValid(string name) => IdentifierPattern().IsMatch(name);
/// <summary>Validates and returns the identifier, or throws on invalid input.</summary>
public static string Validate(string name)
{
if (!IsValid(name))
throw new ArgumentException(
$"Invalid SQL identifier: '{name}'. Only [A-Za-z0-9_] allowed.");
return name;
}
}