C2026-008 - Re-Architect RO.FST to include RO Modification date/time and use those when updating ROs from the RO.FST
This commit is contained in:
@@ -116,12 +116,12 @@ namespace ROEditor
|
||||
public uint thisoff;
|
||||
public string title;
|
||||
|
||||
public FstTmpSTRC(ushort type, uint offset, string tl)
|
||||
public FstTmpSTRC(ushort type, uint offset, string tl)
|
||||
{
|
||||
thistype = type;
|
||||
thisoff = offset;
|
||||
title = tl;
|
||||
}
|
||||
}
|
||||
|
||||
void WriteString(BinaryWriter bw, string str)
|
||||
{
|
||||
@@ -150,7 +150,7 @@ namespace ROEditor
|
||||
bw.Write(thisoff);
|
||||
bw.Write(thistype);
|
||||
WriteString(bw,title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The Sorted Array was not sorting via the ASCII value of each character in a given string.
|
||||
@@ -565,8 +565,8 @@ namespace ROEditor
|
||||
string RecIdStr = elem.GetAttribute("RecID");
|
||||
curRecID = System.Convert.ToUInt32(RecIdStr,16);
|
||||
|
||||
// Get the current node's parent id
|
||||
string ParIdStr = elem.GetAttribute("ParentID");
|
||||
// Get the current node's parent id
|
||||
string ParIdStr = elem.GetAttribute("ParentID");
|
||||
elemParentID = Convert.ToUInt32(ParIdStr,16);
|
||||
|
||||
string HasKids = elem.GetAttribute("HasChild");
|
||||
@@ -771,8 +771,8 @@ namespace ROEditor
|
||||
private ushort SaveROToFST(XmlNode RONode,ArrayList InUseList,string RtnValTmplate, string AccPageIDTplate)
|
||||
{
|
||||
ushort RtnVal;
|
||||
uint startFST = (uint)fhFST.BaseStream.Position;
|
||||
uint RORecID;
|
||||
uint startFST = (uint)fhFST.BaseStream.Position;
|
||||
uint RORecID;
|
||||
uint ParID;
|
||||
byte nullbyte=0;
|
||||
|
||||
@@ -844,8 +844,12 @@ namespace ROEditor
|
||||
AccPageID = " ";
|
||||
WriteString(AccPageID);
|
||||
|
||||
// Save the ID and offset entry for the current ID
|
||||
IdsAndOffsets.Add(RORecID,startFST);
|
||||
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
|
||||
string moddt = ROdatabase.RODB_GetModDateTime(elem.GetAttribute("RecID"), elem.GetAttribute("Table"));
|
||||
if (!string.IsNullOrEmpty(moddt)) WriteString(moddt);
|
||||
|
||||
// Save the ID and offset entry for the current ID
|
||||
IdsAndOffsets.Add(RORecID, startFST);
|
||||
|
||||
// Save the RecID and Accessory Page id
|
||||
IdsAndAccPgIds[AccPageID] = RORecID;
|
||||
|
||||
@@ -322,9 +322,9 @@ namespace RODBInterface
|
||||
get { return _PCChildList; }
|
||||
set { _PCChildList = value; }
|
||||
}
|
||||
#endregion
|
||||
#region abstracts // need these for each method that must be defined for each database type
|
||||
public abstract string RODB_GetNextGroupTable();
|
||||
#endregion
|
||||
#region abstracts // need these for each method that must be defined for each database type
|
||||
public abstract string RODB_GetNextGroupTable();
|
||||
public abstract string RODB_GetNextRecId(string table);
|
||||
public abstract bool RODB_GetRootGroups(VlnXmlElement root);
|
||||
public abstract bool RODB_DeleteGroup(XmlNode group, string tbname, string toprecid);
|
||||
@@ -355,9 +355,10 @@ namespace RODBInterface
|
||||
public abstract string RODB_GetDBServerForAbout();
|
||||
public abstract string RODB_HasBeenConverted();
|
||||
public abstract bool RODB_WriteSqlConnectToAccess(string newConectStr);
|
||||
#endregion
|
||||
public abstract string RODB_GetModDateTime(string Recid, string table);
|
||||
#endregion
|
||||
|
||||
public RODB()
|
||||
public RODB()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -2382,9 +2383,9 @@ namespace RODBInterface
|
||||
RecID = DBE.GetString(0);
|
||||
MyRecID = RecID;
|
||||
Info = DBE.GetString(1);
|
||||
// it's defined in the local table if the first character is "<" which starts
|
||||
// the schema definition string.
|
||||
if ("<" == Info.Substring(0, 1))
|
||||
// it's defined in the local table if the first character is "<" which starts
|
||||
// the schema definition string.
|
||||
if ("<" == Info.Substring(0, 1))
|
||||
{
|
||||
name = ParseEleName(Info);
|
||||
if (name != null)
|
||||
@@ -2425,7 +2426,7 @@ namespace RODBInterface
|
||||
return retlist;
|
||||
}
|
||||
|
||||
public override string RODB_GetSchemaPiece(string Recid, string table)
|
||||
public override string RODB_GetSchemaPiece(string Recid, string table)
|
||||
{
|
||||
string strGetSchemaPiece;
|
||||
string Info;
|
||||
@@ -3082,7 +3083,28 @@ namespace RODBInterface
|
||||
return GrpCnt;
|
||||
}
|
||||
|
||||
}
|
||||
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
|
||||
//Get the Modification Date / Time for the RO
|
||||
public override string RODB_GetModDateTime(string Recid, string table)
|
||||
{
|
||||
using (System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection(strDatabaseConnectionCommand))
|
||||
{
|
||||
connection.Open();
|
||||
using (System.Data.OleDb.OleDbCommand command = connection.CreateCommand())
|
||||
{
|
||||
//Unfortunately Access wont let you paramaterize the table name
|
||||
command.CommandText = $"SELECT ModDateTime FROM {Regex.Replace(table, "[^a-zA-Z0-9]", "")} WHERE RecID = @Value";
|
||||
command.Parameters.Add(new System.Data.OleDb.OleDbParameter
|
||||
{
|
||||
OleDbType = System.Data.OleDb.OleDbType.VarChar,
|
||||
ParameterName = "@Value",
|
||||
Value = Recid
|
||||
});
|
||||
return command.ExecuteScalar().ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1803,9 +1803,9 @@ namespace RODBInterface
|
||||
RecID = reader.GetString(0);
|
||||
MyRecID = RecID;
|
||||
Info = reader.GetString(1);
|
||||
// it's defined in the local table if the first character is "<" which starts
|
||||
// the schema definition string.
|
||||
if ("<" == Info.Substring(0, 1))
|
||||
// it's defined in the local table if the first character is "<" which starts
|
||||
// the schema definition string.
|
||||
if ("<" == Info.Substring(0, 1))
|
||||
{
|
||||
name = ParseEleName(Info);
|
||||
if (name != null)
|
||||
@@ -1859,9 +1859,9 @@ namespace RODBInterface
|
||||
RecID = reader.GetString(0);
|
||||
MyRecID = RecID;
|
||||
Info = reader.GetString(1);
|
||||
// it's defined in the local table if the first character is "<" which starts
|
||||
// the schema definition string.
|
||||
if ("<" == Info.Substring(0, 1))
|
||||
// it's defined in the local table if the first character is "<" which starts
|
||||
// the schema definition string.
|
||||
if ("<" == Info.Substring(0, 1))
|
||||
{
|
||||
name = ParseEleName(Info);
|
||||
if (name != null)
|
||||
@@ -2653,8 +2653,36 @@ namespace RODBInterface
|
||||
}
|
||||
return GrpCnt;
|
||||
}
|
||||
#endregion
|
||||
public static bool TestConnect(string constring)
|
||||
|
||||
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
|
||||
//Get the Modification Date / Time for the RO
|
||||
public override string RODB_GetModDateTime(string Recid, string table)
|
||||
{
|
||||
using (SqlConnection connection = new SqlConnection(strDatabaseConnectionCommand))
|
||||
{
|
||||
connection.Open();
|
||||
using (SqlCommand command = connection.CreateCommand())
|
||||
{
|
||||
command.CommandText = $"SELECT ModDateTime FROM ROALL WHERE RecID = @Value AND ROTable = @table";
|
||||
command.Parameters.Add(new SqlParameter
|
||||
{
|
||||
SqlDbType = SqlDbType.VarChar,
|
||||
ParameterName = "@Value",
|
||||
Value = Recid
|
||||
});
|
||||
command.Parameters.Add(new SqlParameter
|
||||
{
|
||||
SqlDbType = SqlDbType.VarChar,
|
||||
ParameterName = "@table",
|
||||
Value = table
|
||||
});
|
||||
|
||||
return command.ExecuteScalar().ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public static bool TestConnect(string constring)
|
||||
{
|
||||
bool success = false;
|
||||
using (SqlConnection connection = new SqlConnection(constring))
|
||||
|
||||
Reference in New Issue
Block a user