Skip to content

Commit c4b11f5

Browse files
committed
change catalog extension
1 parent a9b17c1 commit c4b11f5

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ obj/
66
*secret*
77
*.minidb
88
.vs/
9-
*.indices.txt
10-
*.tables.txt
9+
*.indices.dbcatalog
10+
*.tables.dbcatalog
1111
workshop/

src/MiniSQL.CatalogManager/Controllers/Catalog_index.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ public bool If_in(string name)
9090
public void AssertExist(string name)
9191
{
9292
if (!If_in(name))
93-
throw new TableOrIndexNotExistsException($"Index {name} not exists");
93+
throw new TableOrIndexNotExistsException($"Index \"{name}\" not exists");
9494
}
9595

9696
public void AssertNotExist(string name)
9797
{
9898
if (If_in(name))
99-
throw new TableOrIndexAlreadyExistsException($"Index {name} already exists");
99+
throw new TableOrIndexAlreadyExistsException($"Index \"{name}\" already exists");
100100
}
101101

102102
//update the rootPage of the index named 'name'
@@ -189,9 +189,9 @@ public string Of_table(string Indexname)
189189
}
190190
public void Load_index()
191191
{
192-
if (System.IO.File.Exists($"{_databaseName}.indices.txt"))
192+
if (System.IO.File.Exists($"{_databaseName}.indices.dbcatalog"))
193193
{
194-
using (FileStream fs = new FileStream($"{_databaseName}.indices.txt", FileMode.Open))
194+
using (FileStream fs = new FileStream($"{_databaseName}.indices.dbcatalog", FileMode.Open))
195195
{
196196
BinaryFormatter bf = new BinaryFormatter();
197197
this.index = bf.Deserialize(fs) as List<Models.Index>;
@@ -208,7 +208,7 @@ public void Load_index()
208208

209209
public void Save_index(List<Models.Index> index)
210210
{
211-
using (FileStream fs = new FileStream($"{_databaseName}.indices.txt", FileMode.Create))
211+
using (FileStream fs = new FileStream($"{_databaseName}.indices.dbcatalog", FileMode.Create))
212212
{
213213
BinaryFormatter bf = new BinaryFormatter();
214214
bf.Serialize(fs, index);

src/MiniSQL.CatalogManager/Controllers/Catalog_table.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ public bool If_in(string name)
9797
public void AssertExist(string name)
9898
{
9999
if (!If_in(name))
100-
throw new TableOrIndexNotExistsException($"Table {name} not exists");
100+
throw new TableOrIndexNotExistsException($"Table \"{name}\" not exists");
101101
}
102102

103103
public void AssertNotExist(string name)
104104
{
105105
if (If_in(name))
106-
throw new TableOrIndexAlreadyExistsException($"Table {name} already exists");
106+
throw new TableOrIndexAlreadyExistsException($"Table \"{name}\" already exists");
107107
}
108108

109109
//update the rootPage of the table named 'name'
@@ -197,9 +197,9 @@ public void DropStatementForTable(DropStatement dropStatement)
197197
//load the table from file and store the data into tables
198198
public void Load_table()
199199
{
200-
if (System.IO.File.Exists($"{_databaseName}.tables.txt"))
200+
if (System.IO.File.Exists($"{_databaseName}.tables.dbcatalog"))
201201
{
202-
using (FileStream fs = new FileStream($"{_databaseName}.tables.txt", FileMode.Open))
202+
using (FileStream fs = new FileStream($"{_databaseName}.tables.dbcatalog", FileMode.Open))
203203
{
204204
BinaryFormatter bf = new BinaryFormatter();
205205
this.tables = bf.Deserialize(fs) as List<Models.Table>;
@@ -216,7 +216,7 @@ public void Load_table()
216216
//save data of tables into the file
217217
public void Save_table(List<Models.Table> tables)
218218
{
219-
using (FileStream fs = new FileStream($"{_databaseName}.tables.txt", FileMode.Create))
219+
using (FileStream fs = new FileStream($"{_databaseName}.tables.dbcatalog", FileMode.Create))
220220
{
221221
BinaryFormatter bf = new BinaryFormatter();
222222
bf.Serialize(fs, tables);

src/MiniSQL.CatalogManager/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,8 @@ static bool CheckUpdate()
496496
static void Main(string[] args)
497497
{
498498
Console.WriteLine("[CatalogManager] Start!");
499-
File.Delete($"./test.indices.txt");
500-
File.Delete($"./test.tables.txt");
499+
File.Delete($"./test.indices.dbcatalog");
500+
File.Delete($"./test.tables.dbcatalog");
501501
CheckCreate();
502502
CheckUpdate();
503503
CheckGetSchemaRecord();

src/MiniSQL.Startup/Controllers/DatabaseController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public void DropDatabase(string databaseName)
4444
IsUsingDatabase = false;
4545
}
4646
File.Delete($"{databaseName}.minidb");
47-
File.Delete($"{databaseName}.indices.txt");
48-
File.Delete($"{databaseName}.tables.txt");
47+
File.Delete($"{databaseName}.indices.dbcatalog");
48+
File.Delete($"{databaseName}.tables.dbcatalog");
4949
}
5050

5151
public void ClosePager()

0 commit comments

Comments
 (0)