Ruby/Rust/QL: move databaseMetadata to prefix.dbscheme

This has no effect on ruby.dbscheme, and adds the relation to
ql.dbscheme and rust.dbscheme. (The relation will be required for
overlay support).
This commit is contained in:
Nick Rolfe
2025-06-25 12:34:06 +01:00
parent 9021168725
commit 57b866bbe1
11 changed files with 14599 additions and 33 deletions

View File

@@ -108,6 +108,12 @@ yaml_locations(unique int locatable: @yaml_locatable ref,
@yaml_locatable = @yaml_node | @yaml_error; @yaml_locatable = @yaml_node | @yaml_error;
/*- Database metadata -*/
databaseMetadata(
string metadataKey: string ref,
string value: string ref
);
/*- QL dbscheme -*/ /*- QL dbscheme -*/
@ql_add_expr_left_type = @ql_add_expr | @ql_aggregate | @ql_call_or_unqual_agg_expr | @ql_comp_term | @ql_conjunction | @ql_disjunction | @ql_expr_annotation | @ql_if_term | @ql_implication | @ql_in_expr | @ql_instance_of | @ql_literal | @ql_mul_expr | @ql_negation | @ql_par_expr | @ql_prefix_cast | @ql_qualified_expr | @ql_quantified | @ql_range | @ql_set_literal | @ql_special_call | @ql_super_ref | @ql_unary_expr | @ql_variable @ql_add_expr_left_type = @ql_add_expr | @ql_aggregate | @ql_call_or_unqual_agg_expr | @ql_comp_term | @ql_conjunction | @ql_disjunction | @ql_expr_annotation | @ql_if_term | @ql_implication | @ql_in_expr | @ql_instance_of | @ql_literal | @ql_mul_expr | @ql_negation | @ql_par_expr | @ql_prefix_cast | @ql_qualified_expr | @ql_quantified | @ql_range | @ql_set_literal | @ql_special_call | @ql_super_ref | @ql_unary_expr | @ql_variable

View File

@@ -22436,5 +22436,41 @@
</dep> </dep>
</dependencies> </dependencies>
</relation> </relation>
<relation>
<name>databaseMetadata</name>
<cardinality>1</cardinality>
<columnsizes>
<e>
<k>metadataKey</k>
<v>1</v>
</e>
<e>
<k>value</k>
<v>1</v>
</e>
</columnsizes>
<dependencies>
<dep>
<src>metadataKey</src>
<trg>value</trg>
<val>
<hist>
<budget>12</budget>
<bs/>
</hist>
</val>
</dep>
<dep>
<src>value</src>
<trg>metadataKey</trg>
<val>
<hist>
<budget>12</budget>
<bs/>
</hist>
</val>
</dep>
</dependencies>
</relation>
</stats> </stats>
</dbstats> </dbstats>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
description: Add databaseMetadata relation
compatibility: full
databaseMetadata.rel: delete

View File

@@ -108,6 +108,12 @@ yaml_locations(unique int locatable: @yaml_locatable ref,
@yaml_locatable = @yaml_node | @yaml_error; @yaml_locatable = @yaml_node | @yaml_error;
/*- Database metadata -*/
databaseMetadata(
string metadataKey: string ref,
string value: string ref
);
// from prefix.dbscheme // from prefix.dbscheme
#keyset[id] #keyset[id]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: Add databaseMetadata relation
compatibility: full

View File

@@ -33,16 +33,6 @@ pub fn generate(
writeln!(dbscheme_writer, include_str!("prefix.dbscheme"))?; writeln!(dbscheme_writer, include_str!("prefix.dbscheme"))?;
// Eventually all languages will have the metadata relation (for overlay support), at which
// point this could be moved to prefix.dbscheme.
if overlay_support {
writeln!(dbscheme_writer, "/*- Database metadata -*/",)?;
dbscheme::write(
&mut dbscheme_writer,
&[dbscheme::Entry::Table(create_database_metadata())],
)?;
}
let mut ql_writer = LineWriter::new(File::create(ql_library_path)?); let mut ql_writer = LineWriter::new(File::create(ql_library_path)?);
writeln!( writeln!(
ql_writer, ql_writer,
@@ -478,26 +468,3 @@ fn create_token_case<'a>(name: &'a str, token_kinds: Map<&'a str, usize>) -> dbs
branches, branches,
} }
} }
fn create_database_metadata() -> dbscheme::Table<'static> {
dbscheme::Table {
name: "databaseMetadata",
keysets: None,
columns: vec![
dbscheme::Column {
db_type: dbscheme::DbColumnType::String,
name: "metadataKey",
unique: false,
ql_type: ql::Type::String,
ql_type_is_ref: true,
},
dbscheme::Column {
db_type: dbscheme::DbColumnType::String,
name: "value",
unique: false,
ql_type: ql::Type::String,
ql_type_is_ref: true,
},
],
}
}

View File

@@ -104,3 +104,9 @@ yaml_locations(unique int locatable: @yaml_locatable ref,
int location: @location_default ref); int location: @location_default ref);
@yaml_locatable = @yaml_node | @yaml_error; @yaml_locatable = @yaml_node | @yaml_error;
/*- Database metadata -*/
databaseMetadata(
string metadataKey: string ref,
string value: string ref
);