pub struct PrimaryKeyCache { /* private fields */ }Expand description
Cache of primary keys for tables
Implementations§
Source§impl PrimaryKeyCache
impl PrimaryKeyCache
Sourcepub fn new() -> PrimaryKeyCache
pub fn new() -> PrimaryKeyCache
Create a new empty cache
Sourcepub async fn discover_keys(
&mut self,
client: &mut Client<Compat<TcpStream>>,
config: &MsSqlSourceConfig,
) -> Result<(), Error>
pub async fn discover_keys( &mut self, client: &mut Client<Compat<TcpStream>>, config: &MsSqlSourceConfig, ) -> Result<(), Error>
Discover primary keys from MS SQL system catalogs
Queries sys.indexes, sys.index_columns, sys.columns, and sys.tables to find primary key columns for all tables in the database.
Sourcepub fn get(&self, table: &str) -> Option<&Vec<String>>
pub fn get(&self, table: &str) -> Option<&Vec<String>>
Get primary key columns for a table Handles both “table” and “schema.table” formats
Sourcepub fn generate_element_id(
&self,
table: &str,
row: &Row,
) -> Result<String, Error>
pub fn generate_element_id( &self, table: &str, row: &Row, ) -> Result<String, Error>
Generate element ID from a row using primary key values
Format: {table_name}:{key_values}
§Arguments
table- Table namerow- Tiberius row with data
§Returns
Element ID string
§Errors
Returns an error if no primary key is configured for the table or if all primary key values are NULL. This is intentional - without a stable primary key, UPDATE and DELETE operations cannot be correctly matched to previous INSERT operations, breaking change tracking.
Trait Implementations§
Source§impl Default for PrimaryKeyCache
impl Default for PrimaryKeyCache
Source§fn default() -> PrimaryKeyCache
fn default() -> PrimaryKeyCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PrimaryKeyCache
impl RefUnwindSafe for PrimaryKeyCache
impl Send for PrimaryKeyCache
impl Sync for PrimaryKeyCache
impl Unpin for PrimaryKeyCache
impl UnsafeUnpin for PrimaryKeyCache
impl UnwindSafe for PrimaryKeyCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more