Squashed commit of the following:
commit de8d79b73e560814ff9fc8a0c3418009682c5ef8 Author: SAIPO <grasste0403@hotmail.com> Date: Tue Nov 23 21:25:44 2021 +0800 任务:搭建Mysql数据库相关框架 1.完成Mysql动态链接库的导入 2.实现基本的服务器连接数据框架 3.实现Sql语句查询框架
This commit is contained in:
parent
07ea6e771c
commit
9ac9e1fd70
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: fd02c799f3f5c4c83b2fc26c105a3821
|
|
||||||
timeCreated: 1453725747
|
|
||||||
licenseType: Store
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,8 +1,8 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 81dbcde0f90df4e9ba9ca2794490e57a
|
guid: 1e21ef92e9c99d34c97d04cc578dbe2c
|
||||||
timeCreated: 1491251885
|
folderAsset: yes
|
||||||
licenseType: Store
|
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
15
Assets/MySQL/DataScriptableObject.cs
Normal file
15
Assets/MySQL/DataScriptableObject.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[CreateAssetMenu(menuName = "MySQL/Create SqlseverData")]
|
||||||
|
public class DataScriptableObject : ScriptableObject
|
||||||
|
{
|
||||||
|
public string IP;
|
||||||
|
public string Port;
|
||||||
|
public string Database;
|
||||||
|
public string User;
|
||||||
|
public string Password;
|
||||||
|
public string Charset;
|
||||||
|
}
|
11
Assets/MySQL/DataScriptableObject.cs.meta
Normal file
11
Assets/MySQL/DataScriptableObject.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 84c222a672e228d4b9c820e3d02d75a2
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
50
Assets/MySQL/GetSQL.cs
Normal file
50
Assets/MySQL/GetSQL.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using MySql.Data.MySqlClient;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
||||||
|
public class GetSQL : MonoBehaviour
|
||||||
|
{
|
||||||
|
public DataScriptableObject dataScriptableObject;
|
||||||
|
|
||||||
|
private string LinkInfo;
|
||||||
|
// Start is called before the first frame update
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
LinkInfo = "server="+dataScriptableObject.IP+";" +
|
||||||
|
"port="+dataScriptableObject.Port+";" +
|
||||||
|
"database="+dataScriptableObject.Database+";" +
|
||||||
|
"user="+dataScriptableObject.User+";" +
|
||||||
|
"password="+dataScriptableObject.Password+";" +
|
||||||
|
"charset="+dataScriptableObject.Charset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<string> GetSqlData(string SQLstatement, string datalist)
|
||||||
|
{
|
||||||
|
List<string> data = new List<string>();
|
||||||
|
data.Clear();
|
||||||
|
MySqlConnection con = new MySqlConnection(LinkInfo);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
con.Open();
|
||||||
|
Debug.Log("连接成功");
|
||||||
|
}
|
||||||
|
catch (MySqlException e)
|
||||||
|
{
|
||||||
|
Debug.Log("连接失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
MySqlCommand cmd = new MySqlCommand(SQLstatement, con);
|
||||||
|
MySqlDataReader reader = cmd.ExecuteReader();
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
data.Add(reader.GetString(datalist).ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
11
Assets/MySQL/GetSQL.cs.meta
Normal file
11
Assets/MySQL/GetSQL.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: db80fd0dedfc2444e8beaf9ab2d443e1
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
20
Assets/MySQL/SQLserver.asset
Normal file
20
Assets/MySQL/SQLserver.asset
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 84c222a672e228d4b9c820e3d02d75a2, type: 3}
|
||||||
|
m_Name: SQLserver
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
IP: 101.35.241.17
|
||||||
|
Port: 3306
|
||||||
|
Database: lyx
|
||||||
|
User: saipo
|
||||||
|
Password: 20010403
|
||||||
|
Charset: utf-8
|
8
Assets/MySQL/SQLserver.asset.meta
Normal file
8
Assets/MySQL/SQLserver.asset.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2ec0091ebaee60d43bbb2432421fc39d
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
Assets/Plugins/MySql.Data.dll
Normal file
BIN
Assets/Plugins/MySql.Data.dll
Normal file
Binary file not shown.
33
Assets/Plugins/MySql.Data.dll.meta
Normal file
33
Assets/Plugins/MySql.Data.dll.meta
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 81a954209d0756d4bbb5c9b91c9445ac
|
||||||
|
PluginImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
iconMap: {}
|
||||||
|
executionOrder: {}
|
||||||
|
defineConstraints: []
|
||||||
|
isPreloaded: 0
|
||||||
|
isOverridable: 0
|
||||||
|
isExplicitlyReferenced: 0
|
||||||
|
validateReferences: 1
|
||||||
|
platformData:
|
||||||
|
- first:
|
||||||
|
Any:
|
||||||
|
second:
|
||||||
|
enabled: 1
|
||||||
|
settings: {}
|
||||||
|
- first:
|
||||||
|
Editor: Editor
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
DefaultValueInitialized: true
|
||||||
|
- first:
|
||||||
|
Windows Store Apps: WindowsStoreApps
|
||||||
|
second:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
CPU: AnyCPU
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: f597f19f656ba56eae4f6a3a7cc528f4
|
|
||||||
timeCreated: 1488828285
|
|
||||||
licenseType: Store
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 48e08dc33330d11e9d4a1b246c52e4f6
|
|
||||||
timeCreated: 1488828285
|
|
||||||
licenseType: Store
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ed09910c0094cb27be8f3ca264680da3
|
|
||||||
timeCreated: 1488828285
|
|
||||||
licenseType: Store
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: cc355dd4cf1e6173beaeb22c2858cbe1
|
|
||||||
timeCreated: 1488828285
|
|
||||||
licenseType: Store
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 2cda990e2423bbf4892e6590ba056729
|
guid: 57c7619c790d5a94890207bd10cc8aca
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
|
@ -572,7 +572,8 @@ PlayerSettings:
|
|||||||
webGLLinkerTarget: 1
|
webGLLinkerTarget: 1
|
||||||
webGLThreadsSupport: 0
|
webGLThreadsSupport: 0
|
||||||
webGLDecompressionFallback: 0
|
webGLDecompressionFallback: 0
|
||||||
scriptingDefineSymbols: {}
|
scriptingDefineSymbols:
|
||||||
|
1: ODIN_INSPECTOR;ODIN_INSPECTOR_3
|
||||||
additionalCompilerArguments: {}
|
additionalCompilerArguments: {}
|
||||||
platformArchitecture: {}
|
platformArchitecture: {}
|
||||||
scriptingBackend: {}
|
scriptingBackend: {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user