* "create user" command now works with the MySQL Data Storage Engine on the userserver.

afrisby
Adam Frisby 2007-06-24 14:36:08 +00:00
parent f3db36fc39
commit 2fde703ebd
5 changed files with 263 additions and 207 deletions

View File

@ -31,16 +31,6 @@ Global
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
({39BD9497-0000-0000-0000-000000000000}).2 = ({62CDF671-0000-0000-0000-000000000000})
({0A563AC1-0000-0000-0000-000000000000}).1 = ({62CDF671-0000-0000-0000-000000000000})
({0F3C3AC1-0000-0000-0000-000000000000}).2 = ({62CDF671-0000-0000-0000-000000000000})
({1E3F341A-0000-0000-0000-000000000000}).1 = ({62CDF671-0000-0000-0000-000000000000})
({21BFC8E2-0000-0000-0000-000000000000}).2 = ({62CDF671-0000-0000-0000-000000000000})
({21BFC8E2-0000-0000-0000-000000000000}).3 = ({7924FD35-0000-0000-0000-000000000000})
({338FA00B-0000-0000-0000-000000000000}).2 = ({62CDF671-0000-0000-0000-000000000000})
({66591469-0000-0000-0000-000000000000}).2 = ({62CDF671-0000-0000-0000-000000000000})
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU

View File

@ -513,6 +513,90 @@ namespace OpenGrid.Framework.Data.MySQL
return returnval; return returnval;
} }
/// <summary>
/// Creates a new user and inserts it into the database
/// </summary>
/// <param name="uuid">User ID</param>
/// <param name="username">First part of the login</param>
/// <param name="lastname">Second part of the login</param>
/// <param name="passwordHash">A salted hash of the users password</param>
/// <param name="passwordSalt">The salt used for the password hash</param>
/// <param name="homeRegion">A regionHandle of the users home region</param>
/// <param name="homeLocX">Home region position vector</param>
/// <param name="homeLocY">Home region position vector</param>
/// <param name="homeLocZ">Home region position vector</param>
/// <param name="homeLookAtX">Home region 'look at' vector</param>
/// <param name="homeLookAtY">Home region 'look at' vector</param>
/// <param name="homeLookAtZ">Home region 'look at' vector</param>
/// <param name="created">Account created (unix timestamp)</param>
/// <param name="lastlogin">Last login (unix timestamp)</param>
/// <param name="inventoryURI">Users inventory URI</param>
/// <param name="assetURI">Users asset URI</param>
/// <param name="canDoMask">I can do mask</param>
/// <param name="wantDoMask">I want to do mask</param>
/// <param name="aboutText">Profile text</param>
/// <param name="firstText">Firstlife text</param>
/// <param name="profileImage">UUID for profile image</param>
/// <param name="firstImage">UUID for firstlife image</param>
/// <returns>Success?</returns>
public bool insertUserRow(libsecondlife.LLUUID uuid, string username, string lastname, string passwordHash, string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ,
float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, string aboutText, string firstText,
libsecondlife.LLUUID profileImage, libsecondlife.LLUUID firstImage)
{
string sql = "INSERT INTO users (`UUID`, `username`, `lastname`, `passwordHash`, `passworldSalt`, `homeRegion`, ";
sql += "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, ";
sql += "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, ";
sql += "`profileFirstText`, `profileImage`, profileFirstImage`) VALUES ";
sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passworldSalt, ?homeRegion, ";
sql += "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX`, ?homeLookAtY, ?homeLookAtZ, ?created, ";
sql += "?lastLogin`, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, ";
sql += "?profileFirstText, ?profileImage, ?profileFirstImage)";
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["?UUID"] = uuid.ToStringHyphenated();
parameters["?username"] = username.ToString();
parameters["?lastname"] = lastname.ToString();
parameters["?passwordHash"] = passwordHash.ToString();
parameters["?passworldSalt"] = passwordSalt.ToString();
parameters["?homeRegion"] = homeRegion.ToString();
parameters["?homeLocationX"] = homeLocX.ToString();
parameters["?homeLocationY"] = homeLocY.ToString();
parameters["?homeLocationZ"] = homeLocZ.ToString();
parameters["?homeLookAtX"] = homeLookAtX.ToString();
parameters["?homeLookAtY"] = homeLookAtY.ToString();
parameters["?homeLookAtZ"] = homeLookAtZ.ToString();
parameters["?created"] = created.ToString();
parameters["?lastLogin"] = lastlogin.ToString();
parameters["?userInventoryURI"] = inventoryURI.ToString();
parameters["?userAssetURI"] = assetURI.ToString();
parameters["?profileCanDoMask"] = canDoMask.ToString();
parameters["?profileWantDoMask"] = wantDoMask.ToString();
parameters["?profileAboutText"] = aboutText.ToString();
parameters["?profileFirstText"] = firstText.ToString();
parameters["?profileImage"] = profileImage.ToStringHyphenated();
parameters["?profileFirstImage"] = firstImage.ToStringHyphenated();
bool returnval = false;
try
{
IDbCommand result = Query(sql, parameters);
if (result.ExecuteNonQuery() == 1)
returnval = true;
result.Dispose();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
return false;
}
return returnval;
}
/// <summary> /// <summary>
/// Inserts a new region into the database /// Inserts a new region into the database
/// </summary> /// </summary>

View File

@ -200,6 +200,20 @@ namespace OpenGrid.Framework.Data.MySQL
/// <param name="user">The user profile to create</param> /// <param name="user">The user profile to create</param>
public void addNewUserProfile(UserProfileData user) public void addNewUserProfile(UserProfileData user)
{ {
try
{
lock (database)
{
database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, user.homeRegion, user.homeLocation.X, user.homeLocation.Y, user.homeLocation.Z,
user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created, user.lastLogin, user.userInventoryURI, user.userAssetURI, user.profileCanDoMask, user.profileWantDoMask,
user.profileAboutText, user.profileFirstText, user.profileImage, user.profileFirstImage);
}
}
catch (Exception e)
{
database.Reconnect();
Console.WriteLine(e.ToString());
}
} }
/// <summary> /// <summary>

View File

@ -1,4 +1,4 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<ProjectType>Local</ProjectType> <ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion> <ProductVersion>8.0.50727</ProductVersion>
@ -6,7 +6,8 @@
<ProjectGuid>{E141F4EE-0000-0000-0000-000000000000}</ProjectGuid> <ProjectGuid>{E141F4EE-0000-0000-0000-000000000000}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon></ApplicationIcon> <ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName> <AssemblyKeyContainerName>
</AssemblyKeyContainerName> </AssemblyKeyContainerName>
<AssemblyName>ServiceManager</AssemblyName> <AssemblyName>ServiceManager</AssemblyName>
@ -15,9 +16,11 @@
<DefaultTargetSchema>IE50</DefaultTargetSchema> <DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign> <DelaySign>false</DelaySign>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<AppDesignerFolder></AppDesignerFolder> <AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>ServiceManager</RootNamespace> <RootNamespace>ServiceManager</RootNamespace>
<StartupObject></StartupObject> <StartupObject>
</StartupObject>
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
</PropertyGroup> </PropertyGroup>
@ -28,7 +31,8 @@
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG</DefineConstants> <DefineConstants>TRACE;DEBUG</DefineConstants>
<DocumentationFile></DocumentationFile> <DocumentationFile>
</DocumentationFile>
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize> <Optimize>False</Optimize>
@ -37,7 +41,8 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors> <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<NoWarn></NoWarn> <NoWarn>
</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@ -46,7 +51,8 @@
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<DocumentationFile></DocumentationFile> <DocumentationFile>
</DocumentationFile>
<DebugSymbols>False</DebugSymbols> <DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize> <Optimize>True</Optimize>
@ -55,7 +61,8 @@
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors> <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<NoWarn></NoWarn> <NoWarn>
</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="libsecondlife.dll"> <Reference Include="libsecondlife.dll">
@ -87,7 +94,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ServiceManager.cs"> <Compile Include="ServiceManager.cs">
<SubType>Code</SubType> <SubType>Component</SubType>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />

View File

@ -41,45 +41,6 @@ Global
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
({438A9556-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
({438A9556-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
({438A9556-0000-0000-0000-000000000000}).5 = ({E88EF749-0000-0000-0000-000000000000})
({438A9556-0000-0000-0000-000000000000}).6 = ({8BE16150-0000-0000-0000-000000000000})
({438A9556-0000-0000-0000-000000000000}).7 = ({632E1BFD-0000-0000-0000-000000000000})
({438A9556-0000-0000-0000-000000000000}).8 = ({8BB20F0A-0000-0000-0000-000000000000})
({438A9556-0000-0000-0000-000000000000}).9 = ({2270B8FE-0000-0000-0000-000000000000})
({438A9556-0000-0000-0000-000000000000}).12 = ({8E81D43C-0000-0000-0000-000000000000})
({8ACA2445-0000-0000-0000-000000000000}).4 = ({8E81D43C-0000-0000-0000-000000000000})
({E88EF749-0000-0000-0000-000000000000}).0 = ({8ACA2445-0000-0000-0000-000000000000})
({546099CD-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000})
({546099CD-0000-0000-0000-000000000000}).3 = ({A7CD0630-0000-0000-0000-000000000000})
({B55C0B5D-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000})
({B55C0B5D-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000})
({B55C0B5D-0000-0000-0000-000000000000}).5 = ({8E81D43C-0000-0000-0000-000000000000})
({4F874463-0000-0000-0000-000000000000}).1 = ({8BE16150-0000-0000-0000-000000000000})
({8BE16150-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000})
({8BE16150-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000})
({63A05FE9-0000-0000-0000-000000000000}).2 = ({8BE16150-0000-0000-0000-000000000000})
({988F0AC4-0000-0000-0000-000000000000}).1 = ({8BE16150-0000-0000-0000-000000000000})
({632E1BFD-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
({632E1BFD-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
({632E1BFD-0000-0000-0000-000000000000}).5 = ({E88EF749-0000-0000-0000-000000000000})
({632E1BFD-0000-0000-0000-000000000000}).6 = ({8BE16150-0000-0000-0000-000000000000})
({632E1BFD-0000-0000-0000-000000000000}).7 = ({8BB20F0A-0000-0000-0000-000000000000})
({632E1BFD-0000-0000-0000-000000000000}).8 = ({2270B8FE-0000-0000-0000-000000000000})
({632E1BFD-0000-0000-0000-000000000000}).11 = ({8E81D43C-0000-0000-0000-000000000000})
({97A82740-0000-0000-0000-000000000000}).0 = ({8ACA2445-0000-0000-0000-000000000000})
({8BB20F0A-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000})
({8BB20F0A-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000})
({8BB20F0A-0000-0000-0000-000000000000}).5 = ({8E81D43C-0000-0000-0000-000000000000})
({EE9E5D96-0000-0000-0000-000000000000}).3 = ({8ACA2445-0000-0000-0000-000000000000})
({EE9E5D96-0000-0000-0000-000000000000}).4 = ({A7CD0630-0000-0000-0000-000000000000})
({E1B79ECF-0000-0000-0000-000000000000}).2 = ({8ACA2445-0000-0000-0000-000000000000})
({E1B79ECF-0000-0000-0000-000000000000}).3 = ({A7CD0630-0000-0000-0000-000000000000})
({6B20B603-0000-0000-0000-000000000000}).1 = ({8ACA2445-0000-0000-0000-000000000000})
({6B20B603-0000-0000-0000-000000000000}).2 = ({A7CD0630-0000-0000-0000-000000000000})
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{438A9556-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {438A9556-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{438A9556-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {438A9556-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU