Checking in latest SDALEO changes optimizing Advantage really only.
This commit is contained in:
@@ -9,28 +9,37 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>_app</RootNamespace>
|
||||
<AssemblyName>!app</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
@@ -43,6 +52,15 @@
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Sdaleo.csproj">
|
||||
<Project>{c919d6d0-e0ae-4d7a-b13d-350fcb4a22ff}</Project>
|
||||
<Name>Sdaleo</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@@ -10,17 +10,26 @@ EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{38FF1664-EDE6-4E9F-BD32-AB1BA99F792D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{38FF1664-EDE6-4E9F-BD32-AB1BA99F792D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{38FF1664-EDE6-4E9F-BD32-AB1BA99F792D}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{38FF1664-EDE6-4E9F-BD32-AB1BA99F792D}.Debug|x86.Build.0 = Debug|x86
|
||||
{38FF1664-EDE6-4E9F-BD32-AB1BA99F792D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{38FF1664-EDE6-4E9F-BD32-AB1BA99F792D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{38FF1664-EDE6-4E9F-BD32-AB1BA99F792D}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{38FF1664-EDE6-4E9F-BD32-AB1BA99F792D}.Release|x86.Build.0 = Release|Any CPU
|
||||
{C919D6D0-E0AE-4D7A-B13D-350FCB4A22FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C919D6D0-E0AE-4D7A-B13D-350FCB4A22FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C919D6D0-E0AE-4D7A-B13D-350FCB4A22FF}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{C919D6D0-E0AE-4D7A-B13D-350FCB4A22FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C919D6D0-E0AE-4D7A-B13D-350FCB4A22FF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C919D6D0-E0AE-4D7A-B13D-350FCB4A22FF}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{C919D6D0-E0AE-4D7A-B13D-350FCB4A22FF}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using Sdaleo;
|
||||
using Sdaleo.Systems.Advantage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -7,14 +9,23 @@ namespace _app
|
||||
{
|
||||
class Program
|
||||
{
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
//var Running = Yaulw.Win32.COM.GetActiveObjects("");
|
||||
//var RunningExcelWorkbooks = Yaulw.Win32.COM.GetRunningObjects();
|
||||
|
||||
//int n1 = Running.Count();
|
||||
//int n2 = RunningExcelWorkbooks.Count();
|
||||
AdvantageCredential cred = new AdvantageCredential(@"\\medisoft_server\medidata\EMBARK RECOVERY LLC\mwddf.add", "user", "password", AdvantageCredential.ServerType.REMOTE_LOCAL);
|
||||
|
||||
DB db = DB.Create(cred);
|
||||
DBRetVal retVal = db.FillDataTable("Select Top 10 FROM MWPAT");
|
||||
if (!retVal.IsValid)
|
||||
{
|
||||
Console.WriteLine(retVal.ErrorMsg);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Fetched successfully");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
3
!app/app.config
Normal file
3
!app/app.config
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
!app/bin/x86/Debug/!app.exe
Normal file
BIN
!app/bin/x86/Debug/!app.exe
Normal file
Binary file not shown.
3
!app/bin/x86/Debug/!app.exe.config
Normal file
3
!app/bin/x86/Debug/!app.exe.config
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
Binary file not shown.
Binary file not shown.
3
!app/bin/x86/Debug/!app.vshost.exe.config
Normal file
3
!app/bin/x86/Debug/!app.vshost.exe.config
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
BIN
!app/bin/x86/Debug/ADSLOC32.dll
Normal file
BIN
!app/bin/x86/Debug/ADSLOC32.dll
Normal file
Binary file not shown.
BIN
!app/bin/x86/Debug/Ace32.dll
Normal file
BIN
!app/bin/x86/Debug/Ace32.dll
Normal file
Binary file not shown.
BIN
!app/bin/x86/Debug/Advantage.Data.Provider.dll
Normal file
BIN
!app/bin/x86/Debug/Advantage.Data.Provider.dll
Normal file
Binary file not shown.
BIN
!app/bin/x86/Debug/Sdaleo.dll
Normal file
BIN
!app/bin/x86/Debug/Sdaleo.dll
Normal file
Binary file not shown.
BIN
!app/bin/x86/Debug/Sdaleo.pdb
Normal file
BIN
!app/bin/x86/Debug/Sdaleo.pdb
Normal file
Binary file not shown.
BIN
!app/bin/x86/Debug/axcws32.dll
Normal file
BIN
!app/bin/x86/Debug/axcws32.dll
Normal file
Binary file not shown.
BIN
!app/bin/x86/Release/!app.exe
Normal file
BIN
!app/bin/x86/Release/!app.exe
Normal file
Binary file not shown.
3
!app/bin/x86/Release/!app.exe.config
Normal file
3
!app/bin/x86/Release/!app.exe.config
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
Binary file not shown.
Binary file not shown.
3
!app/bin/x86/Release/!app.vshost.exe.config
Normal file
3
!app/bin/x86/Release/!app.vshost.exe.config
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
BIN
!app/bin/x86/Release/Advantage.Data.Provider.dll
Normal file
BIN
!app/bin/x86/Release/Advantage.Data.Provider.dll
Normal file
Binary file not shown.
BIN
!app/bin/x86/Release/Sdaleo.dll
Normal file
BIN
!app/bin/x86/Release/Sdaleo.dll
Normal file
Binary file not shown.
BIN
!app/bin/x86/Release/Sdaleo.pdb
Normal file
BIN
!app/bin/x86/Release/Sdaleo.pdb
Normal file
Binary file not shown.
@@ -8,3 +8,10 @@ C:\Users\DieSonne99\Desktop\Yaulw\!app\obj\Debug\!app.exe
|
||||
C:\Users\DieSonne99\Desktop\Yaulw\!app\obj\Debug\!app.pdb
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\obj\Debug\!app.exe
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\obj\Debug\!app.pdb
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\Debug\!app.exe.config
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\Debug\!app.exe
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\Debug\!app.pdb
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\Debug\Sdaleo.dll
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\Debug\Advantage.Data.Provider.dll
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\Debug\Sdaleo.pdb
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\obj\Debug\!app.csprojResolveAssemblyReference.cache
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -8,3 +8,16 @@ C:\Users\DieSonne99\Desktop\Yaulw\!app\obj\Release\!app.exe
|
||||
C:\Users\DieSonne99\Desktop\Yaulw\!app\obj\Release\!app.pdb
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\obj\Release\!app.exe
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\obj\Release\!app.pdb
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\Release\!app.exe.config
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\Release\!app.exe
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\Release\!app.pdb
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\Release\Sdaleo.dll
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\Release\Advantage.Data.Provider.dll
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\Release\Sdaleo.pdb
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\obj\Release\!app.csprojResolveAssemblyReference.cache
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\x86\Release\!app.exe.config
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\x86\Release\!app.exe
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\x86\Release\!app.pdb
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\x86\Release\Sdaleo.dll
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\x86\Release\Advantage.Data.Provider.dll
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\x86\Release\Sdaleo.pdb
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
9
!app/obj/x86/Debug/!app.csproj.FileListAbsolute.txt
Normal file
9
!app/obj/x86/Debug/!app.csproj.FileListAbsolute.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\x86\Debug\!app.exe.config
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\x86\Debug\!app.exe
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\x86\Debug\!app.pdb
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\x86\Debug\Sdaleo.dll
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\x86\Debug\Advantage.Data.Provider.dll
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\bin\x86\Debug\Sdaleo.pdb
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\obj\x86\Debug\!app.csprojResolveAssemblyReference.cache
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\obj\x86\Debug\!app.exe
|
||||
C:\Users\DieSonne99\Desktop\Sdaleo\!app\obj\x86\Debug\!app.pdb
|
||||
BIN
!app/obj/x86/Debug/!app.csprojResolveAssemblyReference.cache
Normal file
BIN
!app/obj/x86/Debug/!app.csprojResolveAssemblyReference.cache
Normal file
Binary file not shown.
BIN
!app/obj/x86/Debug/!app.exe
Normal file
BIN
!app/obj/x86/Debug/!app.exe
Normal file
Binary file not shown.
BIN
!app/obj/x86/Debug/!app.pdb
Normal file
BIN
!app/obj/x86/Debug/!app.pdb
Normal file
Binary file not shown.
Binary file not shown.
BIN
Components/ADSLOC32.dll
Normal file
BIN
Components/ADSLOC32.dll
Normal file
Binary file not shown.
BIN
Components/Ace32.dll
Normal file
BIN
Components/Ace32.dll
Normal file
Binary file not shown.
BIN
Components/axcws32.dll
Normal file
BIN
Components/axcws32.dll
Normal file
Binary file not shown.
75
DB.cs
75
DB.cs
@@ -54,12 +54,22 @@ namespace Sdaleo
|
||||
|
||||
#region NonQuery
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Use this to Run SQL with the ExecuteNonQuery() Command Object
|
||||
/// </summary>
|
||||
/// <param name="SqlCommandText">SQL Text/Commands to execute</param>
|
||||
/// <returns>the result of the ExecuteNonQuery() operation</returns>
|
||||
public DBRetVal ExecuteNonQuery(string SqlCommandText)
|
||||
{
|
||||
return ExecuteNonQuery(SqlCommandText, CommandType.Text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use this to Run SQL with the ExecuteNonQuery() Command Object
|
||||
/// </summary>
|
||||
/// <param name="SqlCommandText">SQL Text/Commands to execute</param>
|
||||
/// <returns>the result of the ExecuteNonQuery() operation</returns>
|
||||
public DBRetVal ExecuteNonQuery(string SqlCommandText, CommandType type)
|
||||
{
|
||||
DBRetVal retVal = new DBRetVal();
|
||||
try
|
||||
@@ -70,6 +80,7 @@ namespace Sdaleo
|
||||
using (DbCommand cmd = conn.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = SqlCommandText;
|
||||
cmd.CommandType = type;
|
||||
if(_ConnectionStrObj.SupportsTimeouts)
|
||||
cmd.CommandTimeout = (int) _ConnectionStrObj.Timeouts.CommandTimeout;
|
||||
int nRows = cmd.ExecuteNonQuery();
|
||||
@@ -91,6 +102,17 @@ namespace Sdaleo
|
||||
/// <param name="parameters">Allows the use of DBMS Independent parameters</param>
|
||||
/// <returns>the result of the ExecuteNonQuery() operation</returns>
|
||||
public DBRetVal ExecuteNonQuery(string SqlCommandText, DBMSIndParameter[] parameters)
|
||||
{
|
||||
return ExecuteNonQuery(SqlCommandText, CommandType.Text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use this to Run SQL with the ExecuteNonQuery() Command Object
|
||||
/// </summary>
|
||||
/// <param name="SqlCommandText">SQL Text/Commands to execute</param>
|
||||
/// <param name="parameters">Allows the use of DBMS Independent parameters</param>
|
||||
/// <returns>the result of the ExecuteNonQuery() operation</returns>
|
||||
public DBRetVal ExecuteNonQuery(string SqlCommandText, DBMSIndParameter[] parameters, CommandType type)
|
||||
{
|
||||
DBRetVal retVal = new DBRetVal();
|
||||
try
|
||||
@@ -101,6 +123,7 @@ namespace Sdaleo
|
||||
using (DbCommand cmd = conn.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = SqlCommandText;
|
||||
cmd.CommandType = type;
|
||||
if (_ConnectionStrObj.SupportsTimeouts)
|
||||
cmd.CommandTimeout = (int)_ConnectionStrObj.Timeouts.CommandTimeout;
|
||||
|
||||
@@ -130,6 +153,16 @@ namespace Sdaleo
|
||||
/// <param name="SqlText">SQL Text to execute</param>
|
||||
/// <returns>the result of the ExecuteScalar() operation</returns>
|
||||
public DBRetVal ExecuteScalar(string SqlText)
|
||||
{
|
||||
return ExecuteScalar(SqlText, CommandType.Text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use this to Run SQL with the ExecuteScalar() Command Object
|
||||
/// </summary>
|
||||
/// <param name="SqlText">SQL Text to execute</param>
|
||||
/// <returns>the result of the ExecuteScalar() operation</returns>
|
||||
public DBRetVal ExecuteScalar(string SqlText, CommandType type)
|
||||
{
|
||||
DBRetVal retVal = new DBRetVal();
|
||||
try
|
||||
@@ -140,6 +173,7 @@ namespace Sdaleo
|
||||
using (DbCommand cmd = conn.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = SqlText;
|
||||
cmd.CommandType = type;
|
||||
if (_ConnectionStrObj.SupportsTimeouts)
|
||||
cmd.CommandTimeout = (int)_ConnectionStrObj.Timeouts.CommandTimeout;
|
||||
object oResult = cmd.ExecuteScalar();
|
||||
@@ -161,6 +195,17 @@ namespace Sdaleo
|
||||
/// <param name="parameters">Allows the use of DBMS Independent parameters</param>
|
||||
/// <returns>the result of the ExecuteScalar() operation</returns>
|
||||
public DBRetVal ExecuteScalar(string SqlText, DBMSIndParameter[] parameters)
|
||||
{
|
||||
return ExecuteScalar(SqlText, parameters, CommandType.Text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use this to Run SQL with the ExecuteScalar() Command Object
|
||||
/// </summary>
|
||||
/// <param name="SqlText">SQL Text to execute</param>
|
||||
/// <param name="parameters">Allows the use of DBMS Independent parameters</param>
|
||||
/// <returns>the result of the ExecuteScalar() operation</returns>
|
||||
public DBRetVal ExecuteScalar(string SqlText, DBMSIndParameter[] parameters, CommandType type)
|
||||
{
|
||||
DBRetVal retVal = new DBRetVal();
|
||||
try
|
||||
@@ -171,6 +216,7 @@ namespace Sdaleo
|
||||
using (DbCommand cmd = conn.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = SqlText;
|
||||
cmd.CommandType = type;
|
||||
if (_ConnectionStrObj.SupportsTimeouts)
|
||||
cmd.CommandTimeout = (int)_ConnectionStrObj.Timeouts.CommandTimeout;
|
||||
|
||||
@@ -194,12 +240,22 @@ namespace Sdaleo
|
||||
|
||||
#region DataTable
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Use this to Run SQL with the DataAdapter Fill()
|
||||
/// </summary>
|
||||
/// <param name="SqlText">SQL Text to execute</param>
|
||||
/// <returns>the result of the DataAdapter Fill() operation</returns>
|
||||
public DBRetVal FillDataTable(string SqlText)
|
||||
{
|
||||
return FillDataTable(SqlText, CommandType.Text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use this to Run SQL with the DataAdapter Fill()
|
||||
/// </summary>
|
||||
/// <param name="SqlText">SQL Text to execute</param>
|
||||
/// <returns>the result of the DataAdapter Fill() operation</returns>
|
||||
public DBRetVal FillDataTable(string SqlText, CommandType type)
|
||||
{
|
||||
DBRetVal retVal = new DBRetVal();
|
||||
try
|
||||
@@ -210,6 +266,7 @@ namespace Sdaleo
|
||||
using (DbCommand cmd = conn.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = SqlText;
|
||||
cmd.CommandType = type;
|
||||
if (_ConnectionStrObj.SupportsTimeouts)
|
||||
cmd.CommandTimeout = (int)_ConnectionStrObj.Timeouts.CommandTimeout;
|
||||
|
||||
@@ -229,13 +286,24 @@ namespace Sdaleo
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Use this to Run SQL with the DataAdapter Fill()
|
||||
/// </summary>
|
||||
/// <param name="SqlText">SQL Text to execute</param>
|
||||
/// <param name="parameters">Allows the use of DBMS Independent parameters</param>
|
||||
/// <returns>the result of the DataAdapter Fill() operation</returns>
|
||||
public DBRetVal FillDataTable(string SqlText, DBMSIndParameter[] parameters)
|
||||
{
|
||||
return FillDataTable(SqlText, parameters, CommandType.Text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use this to Run SQL with the DataAdapter Fill()
|
||||
/// </summary>
|
||||
/// <param name="SqlText">SQL Text to execute</param>
|
||||
/// <param name="parameters">Allows the use of DBMS Independent parameters</param>
|
||||
/// <returns>the result of the DataAdapter Fill() operation</returns>
|
||||
public DBRetVal FillDataTable(string SqlText, DBMSIndParameter[] parameters, CommandType type)
|
||||
{
|
||||
DBRetVal retVal = new DBRetVal();
|
||||
try
|
||||
@@ -246,6 +314,7 @@ namespace Sdaleo
|
||||
using (DbCommand cmd = conn.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = SqlText;
|
||||
cmd.CommandType = type;
|
||||
if (_ConnectionStrObj.SupportsTimeouts)
|
||||
cmd.CommandTimeout = (int)_ConnectionStrObj.Timeouts.CommandTimeout;
|
||||
|
||||
|
||||
85
DBError.cs
85
DBError.cs
@@ -11,17 +11,47 @@ namespace Sdaleo
|
||||
/// Our Custom Database Error Class that DB Functions Return to External Callers
|
||||
/// </summary>
|
||||
public class DBError
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// Used internally to quickly create a custom error object for
|
||||
/// default Database Layer Errors
|
||||
/// </summary>
|
||||
/// <param name="ErrorMsg">The Error Message to Display</param>
|
||||
internal const int DATABASE_LAYER_ERROR_NUMBER = 1978;
|
||||
|
||||
/// <summary>
|
||||
/// Error number defaulted to -1
|
||||
/// </summary>
|
||||
public int nError { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Error message defaulted to ""
|
||||
/// </summary>
|
||||
public string ErrorMsg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of Error IDs (defaulted to null)
|
||||
/// </summary>
|
||||
public ICollection Errors { get; set; }
|
||||
|
||||
#region Construction
|
||||
|
||||
/// <summary>
|
||||
/// Create a defaulted Error Object
|
||||
/// </summary>
|
||||
public DBError()
|
||||
{
|
||||
nError = -1;
|
||||
ErrorMsg = String.Empty;
|
||||
Errors = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a custom Error Object
|
||||
/// </summary>
|
||||
/// <param name="nError"></param>
|
||||
/// <param name="ErrorMsg"></param>
|
||||
/// <param name="Errors"></param>
|
||||
public DBError(int nError, string ErrorMsg, ICollection Errors)
|
||||
{
|
||||
this.nError = nError;
|
||||
@@ -30,35 +60,40 @@ namespace Sdaleo
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used internally to quickly create a custom error object
|
||||
/// Initialize DBError with SDaleo Default Error Info
|
||||
/// </summary>
|
||||
/// <param name="ErrorMsg">The Error Message to Display</param>
|
||||
private const int DATABASE_LAYER_ERROR_NUMBER = 1978;
|
||||
public DBError(string ErrorMsg)
|
||||
{
|
||||
this.nError = DATABASE_LAYER_ERROR_NUMBER;
|
||||
this.ErrorMsg = ErrorMsg;
|
||||
this.Errors = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal Static
|
||||
|
||||
/// <summary>
|
||||
/// Create a Default DatabaseLayer Sdaleo Error
|
||||
/// </summary>
|
||||
/// <param name="ErrorMsg"></param>
|
||||
/// <returns></returns>
|
||||
internal static DBError Create(string ErrorMsg)
|
||||
{
|
||||
return new DBError(DATABASE_LAYER_ERROR_NUMBER, ErrorMsg, null);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ErrorOccured { get { return (nError != -1 && !String.IsNullOrEmpty(ErrorMsg)); } }
|
||||
public int GetErrorCount { get { if (Errors != null) { return Errors.Count; } return 0; } }
|
||||
public List<int> GetAllErrorNumbers
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Errors != null)
|
||||
{
|
||||
List<int> list = new List<int>();
|
||||
#endregion
|
||||
|
||||
// * DBMS SPECIFIC *
|
||||
// TO DO
|
||||
foreach (SqlError error in Errors)
|
||||
list.Add(error.Number);
|
||||
//
|
||||
|
||||
return list;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Did an error occur? nError != -1 and ErrorMsg != ""
|
||||
/// </summary>
|
||||
public bool ErrorOccured
|
||||
{
|
||||
get
|
||||
{
|
||||
return (nError != -1 && !String.IsNullOrEmpty(ErrorMsg));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
35
DBRetVal.cs
35
DBRetVal.cs
@@ -42,6 +42,8 @@ namespace Sdaleo
|
||||
}
|
||||
private Mode _Mode = Mode.MODE_INIT;
|
||||
|
||||
#region Construction
|
||||
|
||||
/// <summary>
|
||||
/// Initialize DBRetVal
|
||||
/// </summary>
|
||||
@@ -68,7 +70,22 @@ namespace Sdaleo
|
||||
RetVal_int = Int32.MinValue;
|
||||
}
|
||||
|
||||
#region Validator
|
||||
/// <summary>
|
||||
/// Initialize DBRetVal with SDaleo Default Error Info
|
||||
/// </summary>
|
||||
public DBRetVal(string ErrorMsg)
|
||||
: base(ErrorMsg)
|
||||
{
|
||||
_Mode = Mode.MODE_INIT;
|
||||
Result = DBRetValEnum.FAILED;
|
||||
RetVal_datatable = null;
|
||||
RetVal_string = String.Empty;
|
||||
RetVal_int = Int32.MinValue;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Validator
|
||||
|
||||
/// <summary>
|
||||
/// Returns True if the Return value of this object is valid
|
||||
@@ -128,6 +145,22 @@ namespace Sdaleo
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the First Row of the DataTable Return Value
|
||||
/// </summary>
|
||||
/// <returns>valid datatable or throws Exception, if in invalid state</returns>
|
||||
public DataRow GetDataTableFirstRow()
|
||||
{
|
||||
if (_Mode == Mode.MODE_VALUE_DT)
|
||||
{
|
||||
return RetVal_datatable.Rows[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(String.Format("Invalid State {0}. Can not call GetRetVal() for DataTable right now", _Mode.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the Scalar/String Return Value
|
||||
/// </summary>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
|
||||
namespace Sdaleo
|
||||
{
|
||||
@@ -55,4 +56,12 @@ namespace Sdaleo
|
||||
IConnectDb WithCommandTimeout(uint nCommandTimeout);
|
||||
IConnectDb WithTimeouts(uint nConnectionTimeout, uint nCommandTimeout);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Expose Connection Pool Clearing
|
||||
/// </summary>
|
||||
public interface IClearConnectionPool
|
||||
{
|
||||
void ClearConnectionPool(IConnectDb cn);
|
||||
}
|
||||
}
|
||||
|
||||
447
Internal/DBMS.cs
447
Internal/DBMS.cs
@@ -2,13 +2,26 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using Sdaleo.Systems;
|
||||
using System.Data.Common;
|
||||
|
||||
#if SQLSERVER
|
||||
using System.Data.SqlClient;
|
||||
using System.Collections;
|
||||
#endif
|
||||
#if SQLCOMPACT
|
||||
using System.Data.SqlServerCe;
|
||||
using Sdaleo.Systems;
|
||||
using Devart.Data.PostgreSql;
|
||||
#endif
|
||||
#if ADVANTAGE
|
||||
using Advantage.Data.Provider;
|
||||
#endif
|
||||
#if CTREE
|
||||
#endif
|
||||
#if MYSQL
|
||||
#endif
|
||||
#if POSTGRES
|
||||
//using Devart.Data.PostgreSql;
|
||||
#endif
|
||||
|
||||
namespace Sdaleo
|
||||
{
|
||||
@@ -17,6 +30,8 @@ namespace Sdaleo
|
||||
/// </summary>
|
||||
internal static class DBMS
|
||||
{
|
||||
#region Connection DB Specifics
|
||||
|
||||
/// <summary>
|
||||
/// Creates a Connection Object depending on the type of DBMS we are using
|
||||
/// </summary>
|
||||
@@ -30,34 +45,37 @@ namespace Sdaleo
|
||||
{
|
||||
switch (dbsystem)
|
||||
{
|
||||
#if SQLSERVER
|
||||
case DBSystem.SQL_SERVER:
|
||||
if(SystemAvailable.Check(dbsystem))
|
||||
connection = (DbConnection)new SqlConnection(ConnectionStr);
|
||||
connection = (DbConnection)new SqlConnection(ConnectionStr);
|
||||
break;
|
||||
|
||||
case DBSystem.SQL_CE:
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
connection = (DbConnection)new SqlCeConnection(ConnectionStr);
|
||||
#endif
|
||||
#if SQLCOMPACT
|
||||
case DBSystem.SQL_CE:
|
||||
connection = (DbConnection)new SqlCeConnection(ConnectionStr);
|
||||
break;
|
||||
|
||||
#endif
|
||||
#if ADVANTAGE
|
||||
case DBSystem.ADVANTAGE:
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
connection = (DbConnection)new SqlCeConnection(ConnectionStr);
|
||||
connection = (DbConnection)new AdsConnection(ConnectionStr);
|
||||
break;
|
||||
|
||||
#endif
|
||||
#if CTREE
|
||||
case DBSystem.CTREE:
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
connection = (DbConnection)new SqlCeConnection(ConnectionStr);
|
||||
connection = null;
|
||||
break;
|
||||
|
||||
#endif
|
||||
#if MYSQL
|
||||
case DBSystem.MYSQL:
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
connection = (DbConnection)new SqlCeConnection(ConnectionStr);
|
||||
connection = null;
|
||||
break;
|
||||
|
||||
#endif
|
||||
#if POSTGRES
|
||||
case DBSystem.POSTGRES:
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
connection = (DbConnection)new PgSqlConnection(ConnectionStr);
|
||||
connection = null;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -75,118 +93,41 @@ namespace Sdaleo
|
||||
DbDataAdapter dbDataAdapter = null;
|
||||
switch (dbsystem)
|
||||
{
|
||||
case DBSystem.SQL_SERVER:
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
dbDataAdapter = new SqlDataAdapter((SqlCommand) dbcommand);
|
||||
#if SQLSERVER
|
||||
case DBSystem.SQL_SERVER:
|
||||
dbDataAdapter = new SqlDataAdapter((SqlCommand) dbcommand);
|
||||
break;
|
||||
|
||||
#endif
|
||||
#if SQLCOMPACT
|
||||
case DBSystem.SQL_CE:
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
dbDataAdapter = new SqlCeDataAdapter((SqlCeCommand) dbcommand);
|
||||
dbDataAdapter = new SqlCeDataAdapter((SqlCeCommand) dbcommand);
|
||||
break;
|
||||
|
||||
#endif
|
||||
#if ADVANTAGE
|
||||
case DBSystem.ADVANTAGE:
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
dbDataAdapter = new SqlCeDataAdapter((SqlCeCommand)dbcommand);
|
||||
dbDataAdapter = new AdsDataAdapter((AdsCommand) dbcommand);
|
||||
break;
|
||||
|
||||
#endif
|
||||
#if CTREE
|
||||
case DBSystem.CTREE:
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
dbDataAdapter = new SqlCeDataAdapter((SqlCeCommand)dbcommand);
|
||||
dbDataAdapter = null;
|
||||
break;
|
||||
|
||||
#endif
|
||||
#if MYSQL
|
||||
case DBSystem.MYSQL:
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
dbDataAdapter = new SqlCeDataAdapter((SqlCeCommand)dbcommand);
|
||||
dbDataAdapter = null;
|
||||
break;
|
||||
|
||||
case DBSystem.POSTGRES:
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
dbDataAdapter = new PgSqlDataAdapter((PgSqlCommand)dbcommand);
|
||||
#endif
|
||||
#if POSTGRES
|
||||
case DBSystem.POSTGRES:
|
||||
dbDataAdapter = null;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return dbDataAdapter;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an Error Object to be returned to the Caller, fills values depending on DBMS
|
||||
/// </summary>
|
||||
/// <param name="dbsystem">the DBSystem you want an Error for</param>
|
||||
/// <param name="e">the exception being thrown by the DBMS</param>
|
||||
/// <returns>a DBRetVal Object filled with the Error Data, or null if system is not available</returns>
|
||||
internal static DBRetVal CreateErrorDBRetVal(DBSystem dbsystem, Exception e)
|
||||
{
|
||||
DBRetVal retVal = null;
|
||||
switch (dbsystem)
|
||||
{
|
||||
case DBSystem.SQL_SERVER:
|
||||
{
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
{
|
||||
SqlException ex = e as SqlException;
|
||||
if (ex != null)
|
||||
retVal = new DBRetVal(ex.Number, ex.Message, ex.Errors);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case DBSystem.SQL_CE:
|
||||
{
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
{
|
||||
SqlCeException ex = e as SqlCeException;
|
||||
if (ex != null)
|
||||
retVal = new DBRetVal(ex.NativeError, ex.Message, ex.Errors);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case DBSystem.ADVANTAGE:
|
||||
{
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
{
|
||||
SqlCeException ex = e as SqlCeException;
|
||||
if (ex != null)
|
||||
retVal = new DBRetVal(ex.NativeError, ex.Message, ex.Errors);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case DBSystem.CTREE:
|
||||
{
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
{
|
||||
SqlCeException ex = e as SqlCeException;
|
||||
if (ex != null)
|
||||
retVal = new DBRetVal(ex.NativeError, ex.Message, ex.Errors);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case DBSystem.MYSQL:
|
||||
{
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
{
|
||||
SqlCeException ex = e as SqlCeException;
|
||||
if (ex != null)
|
||||
retVal = new DBRetVal(ex.NativeError, ex.Message, ex.Errors);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case DBSystem.POSTGRES:
|
||||
{
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
{
|
||||
PgSqlException ex = e as PgSqlException;
|
||||
if (ex != null)
|
||||
retVal = new DBRetVal(0, ex.Message, null);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a DBMS Specific Parameter Array from a DMBS Independent Parameter Array
|
||||
@@ -203,64 +144,244 @@ namespace Sdaleo
|
||||
{
|
||||
switch (dbsystem)
|
||||
{
|
||||
#if SQLSERVER
|
||||
case DBSystem.SQL_SERVER:
|
||||
{
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
{
|
||||
param_s.Add(new SqlParameter(parameter.parameterName, parameter.Value));
|
||||
}
|
||||
}
|
||||
param_s.Add(new SqlParameter(parameter.parameterName, parameter.Value));
|
||||
break;
|
||||
|
||||
#endif
|
||||
#if SQLCOMPACT
|
||||
case DBSystem.SQL_CE:
|
||||
{
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
{
|
||||
param_s.Add(new SqlCeParameter(parameter.parameterName, parameter.Value));
|
||||
}
|
||||
}
|
||||
param_s.Add(new SqlCeParameter(parameter.parameterName, parameter.Value));
|
||||
break;
|
||||
|
||||
#endif
|
||||
#if ADVANTAGE
|
||||
case DBSystem.ADVANTAGE:
|
||||
{
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
{
|
||||
param_s.Add(new SqlCeParameter(parameter.parameterName, parameter.Value));
|
||||
}
|
||||
}
|
||||
param_s.Add(new AdsParameter(parameter.parameterName, parameter.Value));
|
||||
break;
|
||||
|
||||
#endif
|
||||
#if CTREE
|
||||
case DBSystem.CTREE:
|
||||
{
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
{
|
||||
param_s.Add(new SqlCeParameter(parameter.parameterName, parameter.Value));
|
||||
}
|
||||
}
|
||||
//param_s.Add(new SqlCeParameter(parameter.parameterName, parameter.Value));
|
||||
break;
|
||||
|
||||
#endif
|
||||
#if MYSQL
|
||||
case DBSystem.MYSQL:
|
||||
{
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
{
|
||||
param_s.Add(new SqlCeParameter(parameter.parameterName, parameter.Value));
|
||||
}
|
||||
}
|
||||
//param_s.Add(new SqlCeParameter(parameter.parameterName, parameter.Value));
|
||||
break;
|
||||
|
||||
case DBSystem.POSTGRES:
|
||||
{
|
||||
if (SystemAvailable.Check(dbsystem))
|
||||
{
|
||||
param_s.Add(new PgSqlParameter(parameter.parameterName, parameter.Value));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if POSTGRES
|
||||
case DBSystem.POSTGRES:
|
||||
//param_s.Add(new PgSqlParameter(parameter.parameterName, parameter.Value));
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Return the Parameter
|
||||
return param_s.ToArray();
|
||||
return param_s.ToArray();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Exception DB Specifics
|
||||
|
||||
/// <summary>
|
||||
/// Creates an Error Object to be returned to the Caller, fills values depending on DBMS
|
||||
/// </summary>
|
||||
/// <param name="dbsystem">the DBSystem you want an Error for</param>
|
||||
/// <param name="e">the exception being thrown by the DBMS</param>
|
||||
/// <returns>a DBRetVal Object filled with the Error Data, or null if system is not available</returns>
|
||||
internal static DBRetVal CreateErrorDBRetVal(DBSystem dbsystem, Exception e)
|
||||
{
|
||||
////
|
||||
// We want to always make sure in this function that we always return a DBRetVal object
|
||||
// we should never return null
|
||||
////
|
||||
DBRetVal retVal = null;
|
||||
if(e == null || String.IsNullOrEmpty(e.Message))
|
||||
{
|
||||
retVal = new DBRetVal("DB Error Exception object is null or with Empty Message");
|
||||
return retVal;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
switch (dbsystem)
|
||||
{
|
||||
#if SQLSERVER
|
||||
case DBSystem.SQL_SERVER:
|
||||
{
|
||||
SqlException ex = e as SqlException;
|
||||
if (ex != null)
|
||||
retVal = new DBRetVal(ex.Number, ex.Message, ex.Errors);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#if SQLCOMPACT
|
||||
case DBSystem.SQL_CE:
|
||||
{
|
||||
SqlCeException ex = e as SqlCeException;
|
||||
if (ex != null)
|
||||
retVal = new DBRetVal(ex.NativeError, ex.Message, ex.Errors);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#if ADVANTAGE
|
||||
case DBSystem.ADVANTAGE:
|
||||
{
|
||||
AdsException ex = e as AdsException;
|
||||
if (ex != null)
|
||||
retVal = new DBRetVal(ex.Number, ex.Message, null);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#if CTREE
|
||||
case DBSystem.CTREE:
|
||||
{
|
||||
//SqlCeException ex = e as SqlCeException;
|
||||
//if (ex != null)
|
||||
// retVal = new DBRetVal(ex.NativeError, ex.Message, ex.Errors);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#if MYSQL
|
||||
case DBSystem.MYSQL:
|
||||
{
|
||||
//SqlCeException ex = e as SqlCeException;
|
||||
//if (ex != null)
|
||||
// retVal = new DBRetVal(ex.NativeError, ex.Message, ex.Errors);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#if POSTGRES
|
||||
case DBSystem.POSTGRES:
|
||||
{
|
||||
//PgSqlException ex = e as PgSqlException;
|
||||
//if (ex != null)
|
||||
// retVal = new DBRetVal(0, ex.Message, null);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
retVal = new DBRetVal(ex.Message);
|
||||
}
|
||||
|
||||
////
|
||||
// We want to always make sure in this function that we always return a DBRetVal object
|
||||
// we should never return null
|
||||
////
|
||||
if (retVal == null)
|
||||
retVal = new DBRetVal("DB Error Exception object could not be created");
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the Error Number for the specified Exception Object for the specified DMBS,
|
||||
/// or -1 if an error occured
|
||||
/// </summary>
|
||||
/// <param name="dbsystem">>the DBSystem you want an Error Number for</param>
|
||||
/// <param name="e">the exception being thrown by the DBMS</param>
|
||||
/// <returns>the Error Number (ID) of the Exception thrown or -1 if anything else happened</returns>
|
||||
internal static int GetErrorNumberForErrorObject(DBSystem dbsystem, Exception e)
|
||||
{
|
||||
int nError = -1;
|
||||
if (e == null || String.IsNullOrEmpty(e.Message))
|
||||
return nError;
|
||||
|
||||
try
|
||||
{
|
||||
switch (dbsystem)
|
||||
{
|
||||
#if SQLSERVER
|
||||
case DBSystem.SQL_SERVER:
|
||||
{
|
||||
SqlException ex = e as SqlException;
|
||||
if (ex != null)
|
||||
nError = ex.Number;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#if SQLCOMPACT
|
||||
case DBSystem.SQL_CE:
|
||||
{
|
||||
SqlCeException ex = e as SqlCeException;
|
||||
if (ex != null)
|
||||
nError = ex.NativeError;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#if ADVANTAGE
|
||||
case DBSystem.ADVANTAGE:
|
||||
{
|
||||
AdsException ex = e as AdsException;
|
||||
if (ex != null)
|
||||
nError = ex.Number;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#if CTREE
|
||||
case DBSystem.CTREE:
|
||||
{
|
||||
//SqlCeException ex = e as SqlCeException;
|
||||
//if (ex != null)
|
||||
// nError = ex.NativeError;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#if MYSQL
|
||||
case DBSystem.MYSQL:
|
||||
{
|
||||
//SqlCeException ex = e as SqlCeException;
|
||||
//if (ex != null)
|
||||
// nError = ex.NativeError;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#if POSTGRES
|
||||
case DBSystem.POSTGRES:
|
||||
{
|
||||
//PgSqlException ex = e as PgSqlException;
|
||||
//if (ex != null)
|
||||
// nError = ex.NativeError;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { /* ignore */ }
|
||||
return nError;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all Error Numbers that the specified DBError has in it's collection.
|
||||
/// If it doesn't have a collection it will just return an empty list.
|
||||
/// </summary>
|
||||
/// <param name="dbsystem"></param>
|
||||
/// <param name="error"></param>
|
||||
/// <returns></returns>
|
||||
internal static List<int> GetAllErrorNumbers(DBSystem dbsystem, DBError error)
|
||||
{
|
||||
List<int> list = new List<int>();
|
||||
if (error != null && error.Errors != null)
|
||||
{
|
||||
foreach (Exception e in error.Errors)
|
||||
{
|
||||
int nError = GetErrorNumberForErrorObject(dbsystem, e);
|
||||
list.Add(nError);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,19 @@ namespace Sdaleo
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if passed in object is valid and is empty
|
||||
/// </summary>
|
||||
/// <param name="oToValidate">an object to validate</param>
|
||||
/// <returns>true if valid, false otherwise</returns>
|
||||
internal static bool IsNotNullAndIsEmpty(object oToValidate)
|
||||
{
|
||||
if ((oToValidate != null) && (oToValidate.ToString() == String.Empty))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert a string to an Object of Type T
|
||||
/// </summary>
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Sdaleo
|
||||
ServerAddress = values[0];
|
||||
InstanceName = values[1];
|
||||
}
|
||||
else if (value.Length > 2)
|
||||
else if (values.Length > 2)
|
||||
{
|
||||
int nIndx = value.LastIndexOf('\\');
|
||||
ServerAddress = value.Substring(0, nIndx);
|
||||
@@ -120,6 +120,11 @@ namespace Sdaleo
|
||||
/// </summary>
|
||||
internal string AttachDBFilename { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
internal string ServerType { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ReadOnly Bool Getters
|
||||
@@ -180,6 +185,26 @@ namespace Sdaleo
|
||||
|
||||
#endregion
|
||||
|
||||
#region Advantage Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Construction Advantage (Set common UDL Settings for Advantage)
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="filename"></param>
|
||||
/// <param name="Password"></param>
|
||||
/// <param name="ServerType"></param>
|
||||
internal UDL(string FileNameNPath, string UserID, string Password, string ServerType)
|
||||
{
|
||||
UseConnectionTimeout = false;
|
||||
this.DataSource = FileNameNPath;
|
||||
this.Username = UserID;
|
||||
this.Password = Password;
|
||||
this.ServerType = ServerType;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SQL Server Constructors
|
||||
|
||||
/// <summary>
|
||||
@@ -330,6 +355,14 @@ namespace Sdaleo
|
||||
strUDL += strAddMore;
|
||||
}
|
||||
|
||||
// Advantage DB
|
||||
if (!String.IsNullOrEmpty(ServerType))
|
||||
{
|
||||
string strAddMore = String.Format("ServerType={0};", ServerType);
|
||||
strUDL += strAddMore;
|
||||
strUDL += "TableType=ADT;";
|
||||
}
|
||||
|
||||
// At the end, specifically add the connection timeout * If asked to *
|
||||
if (UseConnectionTimeout)
|
||||
{
|
||||
@@ -367,41 +400,43 @@ namespace Sdaleo
|
||||
String[] tokens = ConnectionString.Split(';');
|
||||
foreach (string Pair in tokens)
|
||||
{
|
||||
string[] KeyValuePair = Pair.Split('=');
|
||||
string[] KeyValuePair = Pair.Split('=');
|
||||
try
|
||||
{
|
||||
string left = KeyValuePair[0];
|
||||
string right = KeyValuePair[1];
|
||||
switch (KeyValuePair[0].ToUpper().Trim())
|
||||
{
|
||||
case "INITIAL CATALOG":
|
||||
DataBase = KeyValuePair[1].Trim();
|
||||
DataBase = right.Trim();
|
||||
break;
|
||||
|
||||
case "USER ID":
|
||||
Username = KeyValuePair[1].Trim();
|
||||
Username = right.Trim();
|
||||
break;
|
||||
|
||||
case "PASSWORD":
|
||||
Password = KeyValuePair[1];
|
||||
Password = right;
|
||||
break;
|
||||
|
||||
case "DATA SOURCE":
|
||||
DataSource = KeyValuePair[1].Trim();
|
||||
case "DATA SOURCE":
|
||||
DataSource = right.Trim();
|
||||
break;
|
||||
|
||||
case "ATTACHDBFILENAME":
|
||||
AttachDBFilename = KeyValuePair[1].Trim();
|
||||
AttachDBFilename = right.Trim();
|
||||
break;
|
||||
|
||||
case "USER INSTANCE":
|
||||
UserInstance = Boolean.Parse(KeyValuePair[1].Trim());
|
||||
UserInstance = Boolean.Parse(right.Trim());
|
||||
break;
|
||||
|
||||
case "CONNECTION TIMEOUT":
|
||||
ConnectionTimeout = UInt32.Parse(KeyValuePair[1].Trim());
|
||||
ConnectionTimeout = UInt32.Parse(right.Trim());
|
||||
break;
|
||||
|
||||
case "TRUSTED_CONNECTION":
|
||||
TrustedConnection = Boolean.Parse(KeyValuePair[1].Trim());
|
||||
TrustedConnection = Boolean.Parse(right.Trim());
|
||||
break;
|
||||
|
||||
case "INTEGRATED SECURITY":
|
||||
@@ -420,9 +455,13 @@ namespace Sdaleo
|
||||
Encrypt = true;
|
||||
break;
|
||||
|
||||
case "SERVERTYPE":
|
||||
ServerType = KeyValuePair[1].Trim();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception) { /* ignore and continue iteration */ }
|
||||
catch (Exception e) { string m = e.Message; /* ignore and continue iteration */ }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Sdaleo</RootNamespace>
|
||||
<AssemblyName>Sdaleo</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SccProjectName>
|
||||
</SccProjectName>
|
||||
@@ -26,18 +26,20 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\Target\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NET35</DefineConstants>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NET35 ADVANTAGE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\Target\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NET35</DefineConstants>
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NET35 ADVANTAGE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Advantage.Data.Provider">
|
||||
@@ -51,7 +53,10 @@
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL" />
|
||||
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\Program Files (x86)\Microsoft SQL Server Compact Edition\v4.0\Desktop\System.Data.SqlServerCe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
@@ -109,12 +114,17 @@
|
||||
<Compile Include="Systems\ValidationConsts.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Components\Advantage.Data.Provider.dll" />
|
||||
<EmbeddedResource Include="Components\Advantage.Data.Provider.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Components\Devart.Data.dll" />
|
||||
<EmbeddedResource Include="Components\Devart.Data.PostgreSql.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Components\Ace32.dll" />
|
||||
<EmbeddedResource Include="Components\ADSLOC32.dll" />
|
||||
<EmbeddedResource Include="Components\axcws32.dll" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@@ -1,20 +1,30 @@
|
||||
using System;
|
||||
#if ADVANTAGE
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Advantage.Data.Provider;
|
||||
using System.Net;
|
||||
|
||||
namespace Sdaleo.Systems.Advantage
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles SQL CE Credentials, to be
|
||||
/// used by all our SQL CE Functions
|
||||
/// Handles Advantage, to be
|
||||
/// used by all our Advantage Functions
|
||||
/// </summary>
|
||||
public class AdvantageCredential : IComparable, ICloneable, IConnectDb
|
||||
public class AdvantageCredential : IComparable, ICloneable, IConnectDb, IClearConnectionPool
|
||||
{
|
||||
public enum ServerType
|
||||
{
|
||||
REMOTE,
|
||||
LOCAL,
|
||||
REMOTE_LOCAL
|
||||
}
|
||||
|
||||
#region IConnectDb
|
||||
|
||||
/// <summary>
|
||||
/// Let Callers know this is a SQLCE Connection Object
|
||||
/// Let Callers know this is a Advantage Connection Object
|
||||
/// </summary>
|
||||
public DBSystem DBType { get { return DBSystem.ADVANTAGE; } }
|
||||
|
||||
@@ -28,10 +38,8 @@ namespace Sdaleo.Systems.Advantage
|
||||
if (!ValidationConsts.IsValidFileNameNPath(DataSource))
|
||||
return false;
|
||||
|
||||
// For ADS i believe we always want a user and Password
|
||||
|
||||
//if (!String.IsNullOrEmpty(_UDL.Password) && !ValidationConsts.Generic.IsValidPassword(_UDL.Password))
|
||||
// return false;
|
||||
if (!ValidationConsts.Generic.IsValidServerName(User))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -43,32 +51,49 @@ namespace Sdaleo.Systems.Advantage
|
||||
public string ConnectionString { get { return _UDL.ConnectionString; } }
|
||||
|
||||
/// <summary>
|
||||
/// SQL CE uses the File Name and Path as the Datasource
|
||||
/// Advantage the File Name and Path as the Datasource
|
||||
/// </summary>
|
||||
public string DataSource { get { return _UDL.DataSource; } }
|
||||
|
||||
/// <summary>
|
||||
/// SQL CE doesn't use User
|
||||
/// Advantage doesn't use User
|
||||
/// </summary>
|
||||
public string User { get { return _UDL.Username; } }
|
||||
|
||||
/// <summary>
|
||||
/// SQL CE doesn't support DBMS like behaviors
|
||||
/// Advantage Server Type
|
||||
/// </summary>
|
||||
public ServerType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
ServerType type = (ServerType) Enum.Parse(typeof(ServerType), _UDL.ServerType.Replace('|','_'));
|
||||
return type;
|
||||
}
|
||||
catch (Exception) { /* ignore */ }
|
||||
return ServerType.LOCAL;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advantage doesn't really support DBMS like behaviors
|
||||
/// </summary>
|
||||
public bool SupportsDBMS { get { return false; } }
|
||||
|
||||
/// <summary>
|
||||
/// SQL CE doesn't support DBMS like behaviors
|
||||
/// Advantage doesn't support DBMS like behaviors
|
||||
/// </summary>
|
||||
public IamDBMS DBMS { get { return null; } }
|
||||
|
||||
/// <summary>
|
||||
/// SQL CE doesn't support Timeouts
|
||||
/// Advantage * not implemented *
|
||||
/// </summary>
|
||||
public bool SupportsTimeouts { get { return false; } }
|
||||
|
||||
/// <summary>
|
||||
/// SQL CE doesn't support Timeouts
|
||||
/// Advantage * not implemented *
|
||||
/// </summary>
|
||||
public IsupportTimeouts Timeouts { get { return null; } }
|
||||
|
||||
@@ -79,7 +104,7 @@ namespace Sdaleo.Systems.Advantage
|
||||
#region AdvantageCredential Credential Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Create a SQL CE Connection from an UDL Object
|
||||
/// Create a Advantage Connection from an UDL Object
|
||||
/// </summary>
|
||||
/// <param name="udl"></param>
|
||||
internal AdvantageCredential(UDL udl)
|
||||
@@ -89,19 +114,32 @@ namespace Sdaleo.Systems.Advantage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an Untrusted SQLCE Credential * No Encryption Used *
|
||||
/// Create a Advantage Connection
|
||||
/// </summary>
|
||||
public AdvantageCredential(string FileNameNPath)
|
||||
public AdvantageCredential(string FileNameNPathInclUNCPath, string UserID, string Password, ServerType type)
|
||||
{
|
||||
_UDL = new UDL(FileNameNPath, String.Empty);
|
||||
}
|
||||
string serverType = type.ToString().ToUpper().Replace('_', '|');
|
||||
|
||||
if (!String.IsNullOrEmpty(FileNameNPathInclUNCPath) && FileNameNPathInclUNCPath.StartsWith(@"\\"))
|
||||
{
|
||||
int n = FileNameNPathInclUNCPath.IndexOf(@"\", @"\\".Length);
|
||||
if(n != -1)
|
||||
{
|
||||
IPAddress ipaddress;
|
||||
string hostname = FileNameNPathInclUNCPath.Substring(@"\\".Length, n - @"\\".Length);
|
||||
if(IPAddress.TryParse(hostname, out ipaddress))
|
||||
{
|
||||
serverType = ServerType.REMOTE.ToString();
|
||||
if (!hostname.Contains(":"))
|
||||
{
|
||||
// Add Port Number to Ip Address * Required by Advantage * default port is 6262
|
||||
FileNameNPathInclUNCPath = FileNameNPathInclUNCPath.Replace(hostname, hostname + ":6262");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a Trusted SQLCE Credential * Encryption Used *
|
||||
/// </summary>
|
||||
public AdvantageCredential(string FileNameNPath, string strPassword)
|
||||
{
|
||||
_UDL = new UDL(FileNameNPath, strPassword);
|
||||
_UDL = new UDL(FileNameNPathInclUNCPath, UserID, Password, serverType);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -133,5 +171,15 @@ namespace Sdaleo.Systems.Advantage
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IClearConnectionPool Members
|
||||
|
||||
public void ClearConnectionPool(IConnectDb credential)
|
||||
{
|
||||
AdsConnection.FlushConnectionPool(credential.ConnectionString);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if ADVANTAGE
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -11,3 +12,4 @@ namespace Sdaleo.Systems.Advantage
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if ADVANTAGE
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -9,3 +10,4 @@ namespace Sdaleo.Systems.Advantage
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if ADVANTAGE
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -9,3 +10,4 @@ namespace Sdaleo.Systems.Advantage.Internal
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if CTREE
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -9,3 +10,4 @@ namespace Sdaleo.Systems.CTree
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if CTREE
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -9,3 +10,4 @@ namespace Sdaleo.Systems.CTree
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if CTREE
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -9,3 +10,4 @@ namespace Sdaleo.Systems.CTree
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if CTREE
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -9,3 +10,4 @@ namespace Sdaleo.Systems.CTree.Internal
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
145
Systems/ConnStr.cs
Normal file
145
Systems/ConnStr.cs
Normal file
@@ -0,0 +1,145 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Sdaleo.Systems
|
||||
{
|
||||
public static class ConnStr
|
||||
{
|
||||
/// <summary>
|
||||
/// Quick Check to see if a connection string is valid * must have DataSource Key and
|
||||
/// a Value * in order to be considered a valid Connection String
|
||||
/// </summary>
|
||||
/// <param name="ConnectionString"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsConnectionString(string ConnectionString)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(ConnectionString) &&
|
||||
ConnectionString.ToUpper().Contains("DATA SOURCE") &&
|
||||
ConnectionString.Contains("="))
|
||||
{
|
||||
String[] tokens = ConnectionString.Split(';');
|
||||
foreach (string Pair in tokens)
|
||||
{
|
||||
string[] KeyValuePair = Pair.Split('=');
|
||||
try
|
||||
{
|
||||
string left = KeyValuePair[0];
|
||||
string right = KeyValuePair[1];
|
||||
if (String.Compare(KeyValuePair[0].ToUpper().Trim(), "DATA SOURCE", true) == 0)
|
||||
return !String.IsNullOrEmpty(right);
|
||||
}
|
||||
catch (Exception) { /* ignore and continue iteration */ }
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a Connection String Contains the specified Key
|
||||
/// </summary>
|
||||
/// <param name="Key"></param>
|
||||
/// <param name="ConnectionString"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ContainsKey(string Key, string ConnectionString)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(Key) && !String.IsNullOrEmpty(ConnectionString))
|
||||
{
|
||||
String[] tokens = ConnectionString.Split(';');
|
||||
foreach (string Pair in tokens)
|
||||
{
|
||||
string[] KeyValuePair = Pair.Split('=');
|
||||
try
|
||||
{
|
||||
string left = KeyValuePair[0];
|
||||
string right = KeyValuePair[1];
|
||||
if (String.Compare(KeyValuePair[0].ToUpper().Trim(), Key.ToUpper().Trim(), true) == 0)
|
||||
return true;
|
||||
}
|
||||
catch (Exception) { /* ignore and continue iteration */ }
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the value of a Key for the specified Connection String
|
||||
/// </summary>
|
||||
/// <param name="Key"></param>
|
||||
/// <param name="ConnectionString"></param>
|
||||
/// <returns></returns>
|
||||
public static string RetrieveValue(string Key, string ConnectionString)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(Key) && !String.IsNullOrEmpty(ConnectionString))
|
||||
{
|
||||
String[] tokens = ConnectionString.Split(';');
|
||||
foreach (string Pair in tokens)
|
||||
{
|
||||
string[] KeyValuePair = Pair.Split('=');
|
||||
try
|
||||
{
|
||||
string left = KeyValuePair[0];
|
||||
string right = KeyValuePair[1];
|
||||
string FoundValue = "";
|
||||
if(String.Compare(KeyValuePair[0].ToUpper().Trim(), Key.ToUpper().Trim(), true) == 0)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(right))
|
||||
{
|
||||
FoundValue = right.Trim();
|
||||
return FoundValue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception) { /* ignore and continue iteration */ }
|
||||
}
|
||||
}
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to retrieve the DataSource Value from a Connection string.
|
||||
/// If it can it will return that. If it can't it will return the originial
|
||||
/// ConnectionString passed in Trimmed().
|
||||
/// </summary>
|
||||
/// <param name="ConnectionString"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetDataSource(string ConnectionString)
|
||||
{
|
||||
if (IsConnectionString(ConnectionString))
|
||||
{
|
||||
String[] tokens = ConnectionString.Split(';');
|
||||
foreach (string Pair in tokens)
|
||||
{
|
||||
string[] KeyValuePair = Pair.Split('=');
|
||||
try
|
||||
{
|
||||
string left = KeyValuePair[0];
|
||||
string right = KeyValuePair[1];
|
||||
string FoundValue = "";
|
||||
if (String.Compare(KeyValuePair[0].ToUpper().Trim(), "DATA SOURCE", true) == 0)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(right))
|
||||
{
|
||||
FoundValue = right.Trim();
|
||||
return FoundValue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception) { /* ignore and continue iteration */ }
|
||||
}
|
||||
}
|
||||
|
||||
// Migth still be a data source just not from a Connection string
|
||||
// so just return the value trimmed
|
||||
if(!String.IsNullOrEmpty(ConnectionString))
|
||||
return ConnectionString.Trim();
|
||||
else
|
||||
return String.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
83
Systems/DataRet.cs
Normal file
83
Systems/DataRet.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Sdaleo.Systems
|
||||
{
|
||||
/// <summary>
|
||||
/// To Deal with Data Return Type validaton / retrieval
|
||||
/// </summary>
|
||||
public static class DataRet
|
||||
{
|
||||
/// <summary>
|
||||
/// Quickly retrieve a value for a given type
|
||||
/// Will use default value of the type if object is null
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="oToRetrieve"></param>
|
||||
/// <returns></returns>
|
||||
public static T Retrieve<T>(object oToRetrieve)
|
||||
{
|
||||
// Create a Default Type T
|
||||
T retVal = default(T);
|
||||
if (oToRetrieve != null)
|
||||
return ObjTool.ConvertStringToObj<T>(oToRetrieve.ToString());
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Quickly retrieve a value for a given type
|
||||
/// Will use default value passed in, if object is null
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="oToRetrieve"></param>
|
||||
/// <returns></returns>
|
||||
public static T Retrieve<T>(object oToRetrieve, T defaultValue)
|
||||
{
|
||||
// Create a Default Type T
|
||||
T retVal = default(T);
|
||||
if (ObjTool.IsNotNullAndNotEmpty(oToRetrieve))
|
||||
return ObjTool.ConvertStringToObj<T>(oToRetrieve.ToString());
|
||||
else
|
||||
retVal = defaultValue;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Quickly retrieve a string value
|
||||
/// Will use default value passed in, if string is null
|
||||
/// </summary>
|
||||
/// <param name="oToRetrieve"></param>
|
||||
/// <param name="bTrim">set to true to Trim() the string</param>
|
||||
/// <returns></returns>
|
||||
public static string Retrieve(object oToRetrieve, string defaultValue, bool bTrim)
|
||||
{
|
||||
string retVal = String.Empty;
|
||||
if (ObjTool.IsNotNullAndNotEmpty(oToRetrieve))
|
||||
{
|
||||
retVal = oToRetrieve.ToString();
|
||||
if (bTrim)
|
||||
retVal = retVal.Trim();
|
||||
return retVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal = defaultValue;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Quickly retrieve a string value
|
||||
/// Will use "", if string is null.
|
||||
/// Will automatically call Trim().
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string Retrieve(object oToRetrieve)
|
||||
{
|
||||
return Retrieve(oToRetrieve, String.Empty, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if MYSQL
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -9,3 +10,4 @@ namespace Sdaleo.Systems.MySql
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if MYSQL
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -9,3 +10,4 @@ namespace Sdaleo.Systems.MySql
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if MYSQL
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -9,3 +10,4 @@ namespace Sdaleo.Systems.MySql
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if MYSQL
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -9,3 +10,4 @@ namespace Sdaleo.Systems.MySql.Internal
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if POSTGRES
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -16,3 +17,4 @@ namespace Sdaleo.Systems.Postgres
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if POSTGRES
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -9,3 +10,4 @@ namespace Sdaleo.Systems.Postgres
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if POSTGRES
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -9,3 +10,4 @@ namespace Sdaleo.Systems.Postgres
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if POSTGRES
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -164,3 +165,4 @@ namespace Sdaleo.Systems.Postgres.Internal
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if SQLCOMPACT
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -133,3 +134,4 @@ namespace Sdaleo.Systems.SQLCE
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if SQLCOMPACT
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -45,31 +46,31 @@ namespace Sdaleo.Systems.SQLCE
|
||||
public static DBError DatabaseCreate(IConnectDb credential)
|
||||
{
|
||||
DBError dbError = ValidationConsts.IsCredentialValid(credential, DBSystem.SQL_CE);
|
||||
if (dbError.ErrorOccured)
|
||||
return dbError;
|
||||
//if (dbError.ErrorOccured)
|
||||
// return dbError;
|
||||
|
||||
// First Create the Directory if it doesn't exists
|
||||
string path = Path.GetDirectoryName(credential.DataSource);
|
||||
if (!Directory.Exists(path))
|
||||
Directory.CreateDirectory(path);
|
||||
//// First Create the Directory if it doesn't exists
|
||||
//string path = Path.GetDirectoryName(credential.DataSource);
|
||||
//if (!Directory.Exists(path))
|
||||
// Directory.CreateDirectory(path);
|
||||
|
||||
// Now try to create the database if it doesn't exists
|
||||
bool bExists = false;
|
||||
dbError = DatabaseExists(credential, out bExists);
|
||||
if (!bExists)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlCeEngine engine = new SqlCeEngine(credential.ConnectionString))
|
||||
{
|
||||
engine.CreateDatabase();
|
||||
}
|
||||
}
|
||||
catch (SqlCeException e)
|
||||
{
|
||||
dbError = DBMS.CreateErrorDBRetVal(DBSystem.SQL_CE, e);
|
||||
}
|
||||
}
|
||||
//// Now try to create the database if it doesn't exists
|
||||
//bool bExists = false;
|
||||
//dbError = DatabaseExists(credential, out bExists);
|
||||
//if (!bExists)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// using (SqlCeEngine engine = new SqlCeEngine(credential.ConnectionString))
|
||||
// {
|
||||
// engine.CreateDatabase();
|
||||
// }
|
||||
// }
|
||||
// catch (SqlCeException e)
|
||||
// {
|
||||
// dbError = DBMS.CreateErrorDBRetVal(DBSystem.SQL_CE, e);
|
||||
// }
|
||||
//}
|
||||
return dbError;
|
||||
}
|
||||
|
||||
@@ -156,26 +157,26 @@ namespace Sdaleo.Systems.SQLCE
|
||||
public static DBError DatabaseShrink(IConnectDb credential)
|
||||
{
|
||||
DBError dbError = ValidationConsts.IsCredentialValid(credential, DBSystem.SQL_CE);
|
||||
if (dbError.ErrorOccured)
|
||||
return dbError;
|
||||
//if (dbError.ErrorOccured)
|
||||
// return dbError;
|
||||
|
||||
// Now try to shrink the database if it exists
|
||||
bool bExists = false;
|
||||
dbError = DatabaseExists(credential, out bExists);
|
||||
if (bExists)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlCeEngine engine = new SqlCeEngine(credential.ConnectionString))
|
||||
{
|
||||
engine.Shrink();
|
||||
}
|
||||
}
|
||||
catch (SqlCeException e)
|
||||
{
|
||||
dbError = DBMS.CreateErrorDBRetVal(DBSystem.SQL_CE, e);
|
||||
}
|
||||
}
|
||||
//// Now try to shrink the database if it exists
|
||||
//bool bExists = false;
|
||||
//dbError = DatabaseExists(credential, out bExists);
|
||||
//if (bExists)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// using (SqlCeEngine engine = new SqlCeEngine(credential.ConnectionString))
|
||||
// {
|
||||
// engine.Shrink();
|
||||
// }
|
||||
// }
|
||||
// catch (SqlCeException e)
|
||||
// {
|
||||
// dbError = DBMS.CreateErrorDBRetVal(DBSystem.SQL_CE, e);
|
||||
// }
|
||||
//}
|
||||
return dbError;
|
||||
}
|
||||
|
||||
@@ -187,26 +188,26 @@ namespace Sdaleo.Systems.SQLCE
|
||||
public static DBError DatabaseVerify(IConnectDb credential)
|
||||
{
|
||||
DBError dbError = ValidationConsts.IsCredentialValid(credential, DBSystem.SQL_CE);
|
||||
if (dbError.ErrorOccured)
|
||||
return dbError;
|
||||
//if (dbError.ErrorOccured)
|
||||
// return dbError;
|
||||
|
||||
// Now try to repair the database if it exists
|
||||
bool bExists = false;
|
||||
dbError = DatabaseExists(credential, out bExists);
|
||||
if (bExists)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlCeEngine engine = new SqlCeEngine(credential.ConnectionString))
|
||||
{
|
||||
engine.Verify();
|
||||
}
|
||||
}
|
||||
catch (SqlCeException e)
|
||||
{
|
||||
dbError = DBMS.CreateErrorDBRetVal(DBSystem.SQL_CE, e);
|
||||
}
|
||||
}
|
||||
//// Now try to repair the database if it exists
|
||||
//bool bExists = false;
|
||||
//dbError = DatabaseExists(credential, out bExists);
|
||||
//if (bExists)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// using (SqlCeEngine engine = new SqlCeEngine(credential.ConnectionString))
|
||||
// {
|
||||
// engine.Verify();
|
||||
// }
|
||||
// }
|
||||
// catch (SqlCeException e)
|
||||
// {
|
||||
// dbError = DBMS.CreateErrorDBRetVal(DBSystem.SQL_CE, e);
|
||||
// }
|
||||
//}
|
||||
return dbError;
|
||||
}
|
||||
|
||||
@@ -218,30 +219,31 @@ namespace Sdaleo.Systems.SQLCE
|
||||
public static DBError DatabaseRepair(IConnectDb credential)
|
||||
{
|
||||
DBError dbError = ValidationConsts.IsCredentialValid(credential, DBSystem.SQL_CE);
|
||||
if (dbError.ErrorOccured)
|
||||
return dbError;
|
||||
//if (dbError.ErrorOccured)
|
||||
// return dbError;
|
||||
|
||||
// Now try to repair the database if it exists
|
||||
bool bExists = false;
|
||||
dbError = DatabaseExists(credential, out bExists);
|
||||
if (bExists)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SqlCeEngine engine = new SqlCeEngine(credential.ConnectionString))
|
||||
{
|
||||
// Specify null destination connection string for in-place repair
|
||||
engine.Repair(null, RepairOption.RecoverAllPossibleRows);
|
||||
}
|
||||
}
|
||||
catch (SqlCeException e)
|
||||
{
|
||||
dbError = DBMS.CreateErrorDBRetVal(DBSystem.SQL_CE, e);
|
||||
}
|
||||
}
|
||||
//// Now try to repair the database if it exists
|
||||
//bool bExists = false;
|
||||
//dbError = DatabaseExists(credential, out bExists);
|
||||
//if (bExists)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// using (SqlCeEngine engine = new SqlCeEngine(credential.ConnectionString))
|
||||
// {
|
||||
// // Specify null destination connection string for in-place repair
|
||||
// engine.Repair(null, RepairOption.RecoverAllPossibleRows);
|
||||
// }
|
||||
// }
|
||||
// catch (SqlCeException e)
|
||||
// {
|
||||
// dbError = DBMS.CreateErrorDBRetVal(DBSystem.SQL_CE, e);
|
||||
// }
|
||||
//}
|
||||
return dbError;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if SQLCOMPACT
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -39,3 +40,4 @@ namespace Sdaleo.Systems.SQLCE
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if SQLCOMPACT
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -13,3 +14,4 @@ namespace Sdaleo.Systems.SQLCE
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if SQLCOMPACT
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -37,3 +38,4 @@ namespace Sdaleo.Systems.SQLCE
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if SQLCOMPACT
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -93,3 +94,4 @@ namespace Sdaleo.Systems.SQLCE
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
#if SQLSERVER
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace Sdaleo.Systems.SQLServer
|
||||
{
|
||||
@@ -9,7 +11,7 @@ namespace Sdaleo.Systems.SQLServer
|
||||
/// Handles SQL Server Credentials, to be
|
||||
/// used by all our SQL Server Functions
|
||||
/// </summary>
|
||||
public class SQLServerCredential : IComparable, ICloneable, IConnectDb, IamDBMS, IsupportTimeouts
|
||||
public class SQLServerCredential : IComparable, ICloneable, IConnectDb, IamDBMS, IsupportTimeouts, IClearConnectionPool
|
||||
{
|
||||
#region IConnectDb
|
||||
|
||||
@@ -31,7 +33,7 @@ namespace Sdaleo.Systems.SQLServer
|
||||
if (!_UDL.TrustedConnection && !ValidationConsts.Generic.IsValidUserCredential(_UDL.Username, _UDL.Password))
|
||||
return false;
|
||||
|
||||
if (!String.IsNullOrEmpty(_UDL.DataBase) && IsDatabaseSet)
|
||||
if (!String.IsNullOrEmpty(_UDL.DataBase) && !IsDatabaseSet)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -274,6 +276,17 @@ namespace Sdaleo.Systems.SQLServer
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IClearConnectionPool Members
|
||||
|
||||
public void ClearConnectionPool(IConnectDb credential)
|
||||
{
|
||||
SqlConnection cn = new SqlConnection(credential.ConnectionString);
|
||||
SqlConnection.ClearPool(cn);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if SQLSERVER
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -279,10 +280,10 @@ namespace Sdaleo.Systems.SQLServer
|
||||
|
||||
// Upon DB Creation error, see if we could possibly attach the DB
|
||||
bool bErrorOccuredThatCouldMaybeBeResolvedByAttaching = false;
|
||||
if (retVal.ErrorOccured && !retVal.GetAllErrorNumbers.Contains(ErrorConst.ERROR_DB_ALREADY_EXISTS) && (
|
||||
retVal.GetAllErrorNumbers.Contains(ErrorConst.ERROR_DB_SOME_FILE_NAMES_COULD_NOT_BE_CREATED) ||
|
||||
retVal.GetAllErrorNumbers.Contains(ErrorConst.ERROR_DB_CAN_NOT_CREATE_FILE_BECAUSE_IT_ALREADY_EXISTS) ||
|
||||
retVal.GetAllErrorNumbers.Contains(ErrorConst.ERROR_DB_THERE_ALREADY_IS_AN_OBJECT_IN_THE_DB_WITH_THIS_NAME)))
|
||||
if (retVal.ErrorOccured && !DBMS.GetAllErrorNumbers(DBSystem.SQL_SERVER, retVal).Contains(ErrorConst.ERROR_DB_ALREADY_EXISTS) && (
|
||||
DBMS.GetAllErrorNumbers(DBSystem.SQL_SERVER, retVal).Contains(ErrorConst.ERROR_DB_SOME_FILE_NAMES_COULD_NOT_BE_CREATED) ||
|
||||
DBMS.GetAllErrorNumbers(DBSystem.SQL_SERVER, retVal).Contains(ErrorConst.ERROR_DB_CAN_NOT_CREATE_FILE_BECAUSE_IT_ALREADY_EXISTS) ||
|
||||
DBMS.GetAllErrorNumbers(DBSystem.SQL_SERVER, retVal).Contains(ErrorConst.ERROR_DB_THERE_ALREADY_IS_AN_OBJECT_IN_THE_DB_WITH_THIS_NAME)))
|
||||
{
|
||||
bErrorOccuredThatCouldMaybeBeResolvedByAttaching = true;
|
||||
}
|
||||
@@ -336,8 +337,8 @@ namespace Sdaleo.Systems.SQLServer
|
||||
// If Error Occured try renaming dat files to mdf * legacy code *
|
||||
bool bRetryAttachingErrorOccured = false;
|
||||
if (retVal.ErrorOccured &&
|
||||
(retVal.GetAllErrorNumbers.Contains(ErrorConst.ERROR_DB_THERE_ALREADY_IS_AN_OBJECT_IN_THE_DB_WITH_THIS_NAME) ||
|
||||
retVal.GetAllErrorNumbers.Contains(ErrorConst.ERROR_DB_DEVICE_ACTIVATION_FAILED)))
|
||||
(DBMS.GetAllErrorNumbers(DBSystem.SQL_SERVER, retVal).Contains(ErrorConst.ERROR_DB_THERE_ALREADY_IS_AN_OBJECT_IN_THE_DB_WITH_THIS_NAME) ||
|
||||
DBMS.GetAllErrorNumbers(DBSystem.SQL_SERVER, retVal).Contains(ErrorConst.ERROR_DB_DEVICE_ACTIVATION_FAILED)))
|
||||
{
|
||||
bRetryAttachingErrorOccured = true;
|
||||
}
|
||||
@@ -570,3 +571,4 @@ namespace Sdaleo.Systems.SQLServer
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if SQLSERVER
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -480,3 +481,4 @@ namespace Sdaleo.Systems.SQLServer
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if SQLSERVER
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -17,3 +18,4 @@ namespace Sdaleo.Systems.SQLServer
|
||||
public const int ERROR_DB_DEVICE_ACTIVATION_FAILED = 5105;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if SQLSERVER
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -187,3 +188,4 @@ namespace Sdaleo.Systems.SQLServer
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if SQLSERVER
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -73,7 +74,7 @@ namespace Sdaleo.Systems.SQLServer
|
||||
if (values.Length == 2)
|
||||
return ValidationConsts.Generic.IsValidServerName(values[0]) && ValidationConsts.Generic.IsValidInstanceName(values[1]);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(strDataSource) && (strDataSource.IndexOf('\\') == 0))
|
||||
else if (!string.IsNullOrEmpty(strDataSource) && (strDataSource.IndexOf('\\') == -1))
|
||||
{
|
||||
return ValidationConsts.Generic.IsValidServerName(strDataSource);
|
||||
}
|
||||
@@ -98,3 +99,4 @@ namespace Sdaleo.Systems.SQLServer
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if SQLSERVER
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -776,3 +777,4 @@ namespace Sdaleo.Systems.SQLServer
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if SQLSERVER
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -316,3 +317,4 @@ namespace Sdaleo.Systems.SQLServer
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#if SQLSERVER
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -101,3 +102,4 @@ namespace Sdaleo.Systems.SQLServer
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -26,12 +26,12 @@ namespace Sdaleo.Systems
|
||||
public const string CharSet_NotAllowedInDirectorPaths = @"/*?<>|" + "\"";
|
||||
|
||||
// Allowed
|
||||
public const string CharSet_AllowedUserNames = CharSet_CharsNum + " -_";
|
||||
public const string CharSet_AllowedPasswords = CharSet_CharsNum + CharSet_CharsSpecialKeyboardAscii;
|
||||
public const string CharSet_AllowedUserNames = CharSet_CharsAlphaNum + " -_";
|
||||
public const string CharSet_AllowedPasswords = CharSet_CharsAlphaNum + CharSet_CharsSpecialKeyboardAscii;
|
||||
public const string CharSet_AllowedServerNames = CharSet_CharsSambaComputerNames + CharSet_CharsIPAddress; // we allow IP addresses as computer names
|
||||
public const string CharSet_AllowedInstanceNames = CharSet_CharsAlphaNum + "$-_";
|
||||
public const string CharSet_AllowedDatabaseNames = CharSet_CharsAlphaNum + CharSet_CharsSpecialKeyboardAscii;
|
||||
public const string CharSet_AllowedTableNames = CharSet_CharsNum + " -_";
|
||||
public const string CharSet_AllowedTableNames = CharSet_CharsAlphaNum + " -_";
|
||||
|
||||
/// <summary>
|
||||
/// Generic Function to use with Allowed Character Sets above
|
||||
|
||||
BIN
bin/x86/Debug/Advantage.Data.Provider.dll
Normal file
BIN
bin/x86/Debug/Advantage.Data.Provider.dll
Normal file
Binary file not shown.
BIN
bin/x86/Debug/Devart.Data.PostgreSql.dll
Normal file
BIN
bin/x86/Debug/Devart.Data.PostgreSql.dll
Normal file
Binary file not shown.
BIN
bin/x86/Debug/Devart.Data.dll
Normal file
BIN
bin/x86/Debug/Devart.Data.dll
Normal file
Binary file not shown.
BIN
bin/x86/Debug/Sdaleo.dll
Normal file
BIN
bin/x86/Debug/Sdaleo.dll
Normal file
Binary file not shown.
BIN
bin/x86/Debug/Sdaleo.pdb
Normal file
BIN
bin/x86/Debug/Sdaleo.pdb
Normal file
Binary file not shown.
BIN
bin/x86/Release/Advantage.Data.Provider.dll
Normal file
BIN
bin/x86/Release/Advantage.Data.Provider.dll
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user