- 增加 pgsql 索引 B_Tree, Hash, GiST, GIN, SP_GiST, BRIN;

This commit is contained in:
2881099
2023-06-29 15:42:27 +08:00
parent bd71dfd80b
commit 7964785243
10 changed files with 95 additions and 116 deletions

View File

@ -19,7 +19,6 @@ using System.ComponentModel;
using System.Data.Common;
using System.Data.Odbc;
using System.Data.SqlClient;
using System.Data.SQLite;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
@ -35,7 +34,7 @@ using System.Threading.Tasks;
namespace base_entity
{
static class Program
static partial class Program
{
class TestConfig
{
@ -62,11 +61,6 @@ namespace base_entity
static AsyncLocal<IUnitOfWork> _asyncUow = new AsyncLocal<IUnitOfWork>();
public class TestEnumCls
{
public CollationTypeEnum val { get; set; } = CollationTypeEnum.Binary;
}
class Sys_reg_user
{
public Guid Id { get; set; }
@ -590,11 +584,13 @@ namespace base_entity
//.UseNameConvert(FreeSql.Internal.NameConvertType.ToUpper)
//.UseConnectionString(FreeSql.DataType.OdbcDameng, "Driver={DM8 ODBC DRIVER};Server=127.0.0.1:5236;Persist Security Info=False;Trusted_Connection=Yes;UID=USER1;PWD=123456789")
.UseConnectionString(DataType.QuestDb, "host=localhost;port=8812;username=admin;password=quest;database=qdb;ServerCompatibilityMode=NoTypeLoading;")
//.UseConnectionString(DataType.QuestDb, "host=localhost;port=8812;username=admin;password=quest;database=qdb;ServerCompatibilityMode=NoTypeLoading;")
.UseMonitorCommand(cmd =>
{
Console.WriteLine(cmd.CommandText + "\r\n");
//cmd.CommandText = null; //不执行
//if (cmd.CommandText.StartsWith(""))
})
.UseLazyLoading(true)
.UseGenerateCommandParameterWithLambda(true)
@ -602,6 +598,19 @@ namespace base_entity
BaseEntity.Initialization(fsql, () => _asyncUow.Value);
#endregion
test_pgsql(fsql);
var sqliteConnection = new Microsoft.Data.Sqlite.SqliteConnection("data source=123.db");
using(var sqliteSql = new FreeSqlBuilder()
.UseConnectionFactory(DataType.Sqlite,() => sqliteConnection)
.UseAutoSyncStructure(true)
.UseMonitorCommand(cmd => Console.WriteLine(cmd.CommandText))
.Build())
{
sqliteSql.Insert(new User1 { Avatar = "xxxavatar" }).ExecuteAffrows();
var xkdkd = sqliteSql.Select<User1>().ToList();
}
var qr1 = fsql.SelectLongSequence(10, () => new
{
rndstr = QuestFunc.rnd_str(10, 5, 10, 0),

View File

@ -3,6 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@ -15,6 +16,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Npgsql.NetTopologySuite" Version="6.0.4" />
<PackageReference Include="MessagePack" Version="2.4.35" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.5" />
</ItemGroup>
<ItemGroup>
@ -32,7 +34,7 @@
<ProjectReference Include="..\..\Providers\FreeSql.Provider.Oracle\FreeSql.Provider.Oracle.csproj" />
<ProjectReference Include="..\..\Providers\FreeSql.Provider.PostgreSQL\FreeSql.Provider.PostgreSQL.csproj" />
<ProjectReference Include="..\..\Providers\FreeSql.Provider.QuestDb\FreeSql.Provider.QuestDb.csproj" />
<ProjectReference Include="..\..\Providers\FreeSql.Provider.Sqlite\FreeSql.Provider.Sqlite.csproj" />
<ProjectReference Include="..\..\Providers\FreeSql.Provider.SqliteCore\FreeSql.Provider.SqliteCore.csproj" />
<ProjectReference Include="..\..\Providers\FreeSql.Provider.SqlServer\FreeSql.Provider.SqlServer.csproj" />
</ItemGroup>

View File

@ -0,0 +1,25 @@
using FreeSql.DataAnnotations;
using NetTopologySuite.Geometries;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace base_entity
{
partial class Program
{
public static void test_pgsql(IFreeSql fsql)
{
var ddl = fsql.CodeFirst.GetComparisonDDLStatements<gistIndex>();
}
}
[Index("sidx_zjds_geom", nameof(Geom), IndexMethod = IndexMethod.GiST)]
class gistIndex
{
public int bb { get; set; }
public LineString Geom { get; set; }
}
}