PostgreSQLDbMaintenance.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. namespace SqlSugar
  7. {
  8. public class PostgreSQLDbMaintenance : DbMaintenanceProvider
  9. {
  10. #region DML
  11. protected override string GetDataBaseSql
  12. {
  13. get
  14. {
  15. return "SELECT datname FROM pg_database";
  16. }
  17. }
  18. protected override string GetColumnInfosByTableNameSql
  19. {
  20. get
  21. {
  22. string schema = GetSchema();
  23. string sql = @"select cast (pclass.oid as int4) as TableId,cast(ptables.tablename as varchar) as TableName,
  24. pcolumn.column_name as DbColumnName,pcolumn.udt_name as DataType,
  25. CASE WHEN pcolumn.numeric_scale >0 THEN pcolumn.numeric_precision ELSE pcolumn.character_maximum_length END as Length,
  26. pcolumn.column_default as DefaultValue,
  27. pcolumn.numeric_scale as DecimalDigits,
  28. pcolumn.numeric_scale as Scale,
  29. col_description(pclass.oid, pcolumn.ordinal_position) as ColumnDescription,
  30. case when pkey.colname = pcolumn.column_name
  31. then true else false end as IsPrimaryKey,
  32. case when pcolumn.column_default like 'nextval%'
  33. then true else false end as IsIdentity,
  34. case when pcolumn.is_nullable = 'YES'
  35. then true else false end as IsNullable
  36. from (select * from pg_tables where upper(tablename) = upper('{0}') and schemaname='" + schema + @"') ptables inner join pg_class pclass
  37. on ptables.tablename = pclass.relname inner join (SELECT *
  38. FROM information_schema.columns where table_schema='" + schema + @"'
  39. ) pcolumn on pcolumn.table_name = ptables.tablename and upper(pcolumn.table_name) = upper('{0}')
  40. left join (
  41. select pg_class.relname,pg_attribute.attname as colname from
  42. pg_constraint inner join pg_class
  43. on pg_constraint.conrelid = pg_class.oid
  44. inner join pg_attribute on pg_attribute.attrelid = pg_class.oid
  45. and pg_attribute.attnum = pg_constraint.conkey[1]
  46. inner join pg_type on pg_type.oid = pg_attribute.atttypid
  47. where pg_constraint.contype='p'
  48. ) pkey on pcolumn.table_name = pkey.relname
  49. order by table_catalog, table_schema, ordinal_position";
  50. return sql;
  51. }
  52. }
  53. protected override string GetTableInfoListSql
  54. {
  55. get
  56. {
  57. var schema = GetSchema();
  58. return @"select cast(relname as varchar) as Name,
  59. cast(obj_description(c.oid,'pg_class') as varchar) as Description from pg_class c
  60. inner join
  61. pg_namespace n on n.oid = c.relnamespace and nspname='" + schema + @"'
  62. inner join
  63. pg_tables z on z.tablename=c.relname
  64. where relkind in('p', 'r') and relname not like 'pg\_%' and relname not like 'sql\_%' and schemaname='" + schema + "' order by relname";
  65. }
  66. }
  67. protected override string GetViewInfoListSql
  68. {
  69. get
  70. {
  71. return @"select cast(relname as varchar) as Name,cast(Description as varchar) from pg_description
  72. join pg_class on pg_description.objoid = pg_class.oid
  73. where objsubid = 0 and relname in (SELECT viewname from pg_views
  74. WHERE schemaname ='"+GetSchema()+"')";
  75. }
  76. }
  77. #endregion
  78. #region DDL
  79. protected override string CreateDataBaseSql
  80. {
  81. get
  82. {
  83. return "CREATE DATABASE {0}";
  84. }
  85. }
  86. protected override string AddPrimaryKeySql
  87. {
  88. get
  89. {
  90. return "ALTER TABLE {0} ADD PRIMARY KEY({2}) /*{1}*/";
  91. }
  92. }
  93. protected override string AddColumnToTableSql
  94. {
  95. get
  96. {
  97. return "ALTER TABLE {0} ADD COLUMN {1} {2}{3} {4} {5} {6}";
  98. }
  99. }
  100. protected override string AlterColumnToTableSql
  101. {
  102. get
  103. {
  104. return "alter table {0} ALTER COLUMN {1} {2}{3} {4} {5} {6}";
  105. }
  106. }
  107. protected override string BackupDataBaseSql
  108. {
  109. get
  110. {
  111. return "mysqldump.exe {0} -uroot -p > {1} ";
  112. }
  113. }
  114. protected override string CreateTableSql
  115. {
  116. get
  117. {
  118. return "CREATE TABLE {0}(\r\n{1} $PrimaryKey)";
  119. }
  120. }
  121. protected override string CreateTableColumn
  122. {
  123. get
  124. {
  125. return "{0} {1}{2} {3} {4} {5}";
  126. }
  127. }
  128. protected override string TruncateTableSql
  129. {
  130. get
  131. {
  132. return "TRUNCATE TABLE {0}";
  133. }
  134. }
  135. protected override string BackupTableSql
  136. {
  137. get
  138. {
  139. return "create table {0} as (select * from {1} limit {2} offset 0)";
  140. }
  141. }
  142. protected override string DropTableSql
  143. {
  144. get
  145. {
  146. return "DROP TABLE {0}";
  147. }
  148. }
  149. protected override string DropColumnToTableSql
  150. {
  151. get
  152. {
  153. return "ALTER TABLE {0} DROP COLUMN {1}";
  154. }
  155. }
  156. protected override string DropConstraintSql
  157. {
  158. get
  159. {
  160. return "ALTER TABLE {0} DROP CONSTRAINT {1}";
  161. }
  162. }
  163. protected override string RenameColumnSql
  164. {
  165. get
  166. {
  167. return "ALTER TABLE {0} RENAME {1} TO {2}";
  168. }
  169. }
  170. protected override string AddColumnRemarkSql => "comment on column {1}.{0} is '{2}'";
  171. protected override string DeleteColumnRemarkSql => "comment on column {1}.{0} is ''";
  172. protected override string IsAnyColumnRemarkSql { get { throw new NotSupportedException(); } }
  173. protected override string AddTableRemarkSql => "comment on table {0} is '{1}'";
  174. protected override string DeleteTableRemarkSql => "comment on table {0} is ''";
  175. protected override string IsAnyTableRemarkSql { get { throw new NotSupportedException(); } }
  176. protected override string RenameTableSql => "alter table {0} rename to {1}";
  177. protected override string CreateIndexSql
  178. {
  179. get
  180. {
  181. return "CREATE {3} INDEX Index_{0}_{2} ON {0} ({1})";
  182. }
  183. }
  184. protected override string AddDefaultValueSql
  185. {
  186. get
  187. {
  188. return "ALTER TABLE {0} ALTER COLUMN {1} SET DEFAULT {2}";
  189. }
  190. }
  191. protected override string IsAnyIndexSql
  192. {
  193. get
  194. {
  195. return " SELECT count(1) WHERE upper('{0}') IN ( SELECT upper(indexname) FROM pg_indexes )";
  196. }
  197. }
  198. protected override string IsAnyProcedureSql => throw new NotImplementedException();
  199. #endregion
  200. #region Check
  201. protected override string CheckSystemTablePermissionsSql
  202. {
  203. get
  204. {
  205. return "select 1 from information_schema.columns limit 1 offset 0";
  206. }
  207. }
  208. #endregion
  209. #region Scattered
  210. protected override string CreateTableNull
  211. {
  212. get
  213. {
  214. return "DEFAULT NULL";
  215. }
  216. }
  217. protected override string CreateTableNotNull
  218. {
  219. get
  220. {
  221. return "NOT NULL";
  222. }
  223. }
  224. protected override string CreateTablePirmaryKey
  225. {
  226. get
  227. {
  228. return "PRIMARY KEY";
  229. }
  230. }
  231. protected override string CreateTableIdentity
  232. {
  233. get
  234. {
  235. return "serial";
  236. }
  237. }
  238. #endregion
  239. #region Methods
  240. public override List<string> GetDbTypes()
  241. {
  242. var result = this.Context.Ado.SqlQuery<string>(@"SELECT DISTINCT data_type
  243. FROM information_schema.columns");
  244. result.Add("varchar");
  245. result.Add("timestamp");
  246. result.Add("uuid");
  247. result.Add("int2");
  248. result.Add("int4");
  249. result.Add("int8");
  250. result.Add("time");
  251. result.Add("date");
  252. result.Add("float8");
  253. result.Add("float4");
  254. result.Add("json");
  255. result.Add("jsonp");
  256. return result.Distinct().ToList();
  257. }
  258. public override List<string> GetTriggerNames(string tableName)
  259. {
  260. return this.Context.Ado.SqlQuery<string>(@"SELECT tgname
  261. FROM pg_trigger
  262. WHERE tgrelid = '"+tableName+"'::regclass");
  263. }
  264. public override List<string> GetFuncList()
  265. {
  266. return this.Context.Ado.SqlQuery<string>(" SELECT routine_name\r\nFROM information_schema.routines\r\nWHERE lower( routine_schema ) = '" + GetSchema().ToLower() + "' AND routine_type = 'FUNCTION' ");
  267. }
  268. public override List<string> GetIndexList(string tableName)
  269. {
  270. var sql = $"SELECT indexname, indexdef FROM pg_indexes WHERE upper(tablename) = upper('{tableName}')";
  271. return this.Context.Ado.SqlQuery<string>(sql);
  272. }
  273. public override List<string> GetProcList(string dbName)
  274. {
  275. var sql = $"SELECT proname FROM pg_proc p JOIN pg_namespace n ON p.pronamespace = n.oid WHERE n.nspname = '{dbName}'";
  276. return this.Context.Ado.SqlQuery<string>(sql);
  277. }
  278. public override bool AddDefaultValue(string tableName, string columnName, string defaultValue)
  279. {
  280. if (defaultValue?.StartsWith("'")==true&& defaultValue?.EndsWith("'") == true&& defaultValue?.Contains("(") == false
  281. &&!defaultValue.EqualCase("'current_timestamp'") && !defaultValue.EqualCase("'current_date'"))
  282. {
  283. string sql = string.Format(AddDefaultValueSql,this.SqlBuilder.GetTranslationColumnName( tableName), this.SqlBuilder.GetTranslationColumnName(columnName), defaultValue);
  284. return this.Context.Ado.ExecuteCommand(sql) > 0;
  285. }
  286. else if (defaultValue.EqualCase("current_timestamp") || defaultValue.EqualCase("current_date"))
  287. {
  288. string sql = string.Format(AddDefaultValueSql, this.SqlBuilder.GetTranslationColumnName(tableName), this.SqlBuilder.GetTranslationColumnName(columnName), defaultValue );
  289. return this.Context.Ado.ExecuteCommand(sql) > 0;
  290. }
  291. else if (defaultValue?.Contains("(") == false
  292. && !defaultValue.EqualCase("'current_timestamp'") && !defaultValue.EqualCase("'current_date'"))
  293. {
  294. string sql = string.Format(AddDefaultValueSql, this.SqlBuilder.GetTranslationColumnName(tableName), this.SqlBuilder.GetTranslationColumnName(columnName), "'"+defaultValue+"'");
  295. return this.Context.Ado.ExecuteCommand(sql) > 0;
  296. }
  297. else
  298. {
  299. return base.AddDefaultValue(this.SqlBuilder.GetTranslationTableName(tableName), this.SqlBuilder.GetTranslationTableName(columnName), defaultValue);
  300. }
  301. }
  302. public override bool RenameTable(string oldTableName, string newTableName)
  303. {
  304. return base.RenameTable(this.SqlBuilder.GetTranslationTableName(oldTableName), this.SqlBuilder.GetTranslationTableName(newTableName));
  305. }
  306. public override bool AddColumnRemark(string columnName, string tableName, string description)
  307. {
  308. tableName = this.SqlBuilder.GetTranslationTableName(tableName);
  309. string sql = string.Format(this.AddColumnRemarkSql, this.SqlBuilder.GetTranslationColumnName(columnName.ToLower(isAutoToLowerCodeFirst)), tableName, description);
  310. this.Context.Ado.ExecuteCommand(sql);
  311. return true;
  312. }
  313. public override bool AddTableRemark(string tableName, string description)
  314. {
  315. tableName = this.SqlBuilder.GetTranslationTableName(tableName);
  316. return base.AddTableRemark(tableName, description);
  317. }
  318. public override bool UpdateColumn(string tableName, DbColumnInfo columnInfo)
  319. {
  320. ConvertCreateColumnInfo(columnInfo);
  321. tableName = this.SqlBuilder.GetTranslationTableName(tableName);
  322. var columnName= this.SqlBuilder.GetTranslationColumnName(columnInfo.DbColumnName);
  323. string sql = GetUpdateColumnSql(tableName, columnInfo);
  324. this.Context.Ado.ExecuteCommand(sql);
  325. var isnull = columnInfo.IsNullable?" DROP NOT NULL ": " SET NOT NULL ";
  326. this.Context.Ado.ExecuteCommand(string.Format("alter table {0} alter {1} {2}",tableName,columnName, isnull));
  327. return true;
  328. }
  329. protected override string GetUpdateColumnSql(string tableName, DbColumnInfo columnInfo)
  330. {
  331. string columnName = this.SqlBuilder.GetTranslationColumnName(columnInfo.DbColumnName);
  332. tableName = this.SqlBuilder.GetTranslationTableName(tableName);
  333. string dataSize = GetSize(columnInfo);
  334. string dataType = columnInfo.DataType;
  335. if (!string.IsNullOrEmpty(dataType))
  336. {
  337. dataType = " type " + dataType;
  338. }
  339. string nullType = "";
  340. string primaryKey = null;
  341. string identity = null;
  342. string result = string.Format(this.AlterColumnToTableSql, tableName, columnName, dataType, dataSize, nullType, primaryKey, identity);
  343. return result;
  344. }
  345. /// <summary>
  346. ///by current connection string
  347. /// </summary>
  348. /// <param name="databaseDirectory"></param>
  349. /// <returns></returns>
  350. public override bool CreateDatabase(string databaseName, string databaseDirectory = null)
  351. {
  352. if (databaseDirectory != null)
  353. {
  354. if (!FileHelper.IsExistDirectory(databaseDirectory))
  355. {
  356. FileHelper.CreateDirectory(databaseDirectory);
  357. }
  358. }
  359. var oldDatabaseName = this.Context.Ado.Connection.Database;
  360. var connection = this.Context.CurrentConnectionConfig.ConnectionString;
  361. connection = connection.Replace(oldDatabaseName, "postgres");
  362. var newDb = new SqlSugarClient(new ConnectionConfig()
  363. {
  364. DbType = this.Context.CurrentConnectionConfig.DbType,
  365. IsAutoCloseConnection = true,
  366. ConnectionString = connection
  367. });
  368. if (!GetDataBaseList(newDb).Any(it => it.Equals(databaseName, StringComparison.CurrentCultureIgnoreCase)))
  369. {
  370. var isVast = this.Context?.TempItems?.ContainsKey("DbType.Vastbase")==true;
  371. var dbcompatibility = "";
  372. if (isVast)
  373. {
  374. dbcompatibility=" dbcompatibility = 'PG'";
  375. }
  376. newDb.Ado.ExecuteCommand(string.Format(CreateDataBaseSql, this.SqlBuilder.SqlTranslationLeft+databaseName+this.SqlBuilder.SqlTranslationRight, databaseDirectory)+ dbcompatibility);
  377. }
  378. return true;
  379. }
  380. public override bool AddRemark(EntityInfo entity)
  381. {
  382. var db = this.Context;
  383. var columns = entity.Columns.Where(it => it.IsIgnore == false).ToList();
  384. foreach (var item in columns)
  385. {
  386. if (item.ColumnDescription != null)
  387. {
  388. db.DbMaintenance.AddColumnRemark(item.DbColumnName, item.DbTableName, item.ColumnDescription);
  389. }
  390. }
  391. //table remak
  392. if (entity.TableDescription != null)
  393. {
  394. db.DbMaintenance.AddTableRemark(entity.DbTableName, entity.TableDescription);
  395. }
  396. return true;
  397. }
  398. public override bool CreateTable(string tableName, List<DbColumnInfo> columns, bool isCreatePrimaryKey = true)
  399. {
  400. if (columns.HasValue())
  401. {
  402. foreach (var item in columns)
  403. {
  404. ConvertCreateColumnInfo(item);
  405. if (item.DbColumnName.Equals("GUID", StringComparison.CurrentCultureIgnoreCase) && item.Length == 0)
  406. {
  407. item.Length = 10;
  408. }
  409. }
  410. }
  411. string sql = GetCreateTableSql(tableName, columns);
  412. string primaryKeyInfo = null;
  413. if (columns.Any(it => it.IsPrimarykey) && isCreatePrimaryKey)
  414. {
  415. primaryKeyInfo = string.Format(", Primary key({0})", string.Join(",", columns.Where(it => it.IsPrimarykey).Select(it => this.SqlBuilder.GetTranslationColumnName(it.DbColumnName.ToLower(isAutoToLowerCodeFirst)))));
  416. }
  417. sql = sql.Replace("$PrimaryKey", primaryKeyInfo);
  418. this.Context.Ado.ExecuteCommand(sql);
  419. return true;
  420. }
  421. protected override bool IsAnyDefaultValue(string tableName, string columnName, List<DbColumnInfo> columns)
  422. {
  423. var defaultValue = columns.Where(it => it.DbColumnName.Equals(columnName, StringComparison.CurrentCultureIgnoreCase)).First().DefaultValue;
  424. if (defaultValue?.StartsWith("NULL::") == true)
  425. {
  426. return false;
  427. }
  428. return defaultValue.HasValue();
  429. }
  430. protected override string GetCreateTableSql(string tableName, List<DbColumnInfo> columns)
  431. {
  432. List<string> columnArray = new List<string>();
  433. Check.Exception(columns.IsNullOrEmpty(), "No columns found ");
  434. foreach (var item in columns)
  435. {
  436. string columnName = item.DbColumnName;
  437. string dataType = item.DataType;
  438. if (dataType == "varchar" && item.Length == 0)
  439. {
  440. item.Length = 1;
  441. }
  442. //if (dataType == "uuid")
  443. //{
  444. // item.Length = 50;
  445. // dataType = "varchar";
  446. //}
  447. string dataSize = item.Length > 0 ? string.Format("({0})", item.Length) : null;
  448. if (item.DecimalDigits > 0&&item.Length>0 && dataType == "numeric")
  449. {
  450. dataSize = $"({item.Length},{item.DecimalDigits})";
  451. }
  452. string nullType = item.IsNullable ? this.CreateTableNull : CreateTableNotNull;
  453. string primaryKey = null;
  454. string addItem = string.Format(this.CreateTableColumn, this.SqlBuilder.GetTranslationColumnName(columnName.ToLower(isAutoToLowerCodeFirst)), dataType, dataSize, nullType, primaryKey, "");
  455. if (item.IsIdentity)
  456. {
  457. string length = dataType.Substring(dataType.Length - 1);
  458. string identityDataType = "serial" + length;
  459. addItem = addItem.Replace(dataType, identityDataType);
  460. }
  461. columnArray.Add(addItem);
  462. }
  463. string tableString = string.Format(this.CreateTableSql, this.SqlBuilder.GetTranslationTableName(tableName.ToLower(isAutoToLowerCodeFirst)), string.Join(",\r\n", columnArray));
  464. return tableString;
  465. }
  466. public override bool IsAnyConstraint(string constraintName)
  467. {
  468. throw new NotSupportedException("PgSql IsAnyConstraint NotSupportedException");
  469. }
  470. public override bool BackupDataBase(string databaseName, string fullFileName)
  471. {
  472. Check.ThrowNotSupportedException("PgSql BackupDataBase NotSupported");
  473. return false;
  474. }
  475. public override List<DbColumnInfo> GetColumnInfosByTableName(string tableName, bool isCache = true)
  476. {
  477. var result= base.GetColumnInfosByTableName(tableName.TrimEnd('"').TrimStart('"').ToLower(), isCache);
  478. if (result == null || result.Count() == 0)
  479. {
  480. result = base.GetColumnInfosByTableName(tableName, isCache);
  481. }
  482. try
  483. {
  484. string sql = $@"select
  485. kcu.column_name as key_column
  486. from information_schema.table_constraints tco
  487. join information_schema.key_column_usage kcu
  488. on kcu.constraint_name = tco.constraint_name
  489. and kcu.constraint_schema = tco.constraint_schema
  490. and kcu.constraint_name = tco.constraint_name
  491. where tco.constraint_type = 'PRIMARY KEY'
  492. and kcu.table_schema='{GetSchema()}' and
  493. upper(kcu.table_name)=upper('{tableName.TrimEnd('"').TrimStart('"')}')";
  494. List<string> pkList = new List<string>();
  495. if (isCache)
  496. {
  497. pkList=GetListOrCache<string>("GetColumnInfosByTableName_N_Pk"+tableName, sql);
  498. }
  499. else
  500. {
  501. pkList = this.Context.Ado.SqlQuery<string>(sql);
  502. }
  503. if (pkList.Count >1)
  504. {
  505. foreach (var item in result)
  506. {
  507. if (pkList.Select(it=>it.ToUpper()).Contains(item.DbColumnName.ToUpper()))
  508. {
  509. item.IsPrimarykey = true;
  510. }
  511. }
  512. }
  513. }
  514. catch
  515. {
  516. }
  517. return result;
  518. }
  519. #endregion
  520. #region Helper
  521. private bool isAutoToLowerCodeFirst
  522. {
  523. get
  524. {
  525. if (this.Context.CurrentConnectionConfig.MoreSettings == null) return true;
  526. else if (
  527. this.Context.CurrentConnectionConfig.MoreSettings.PgSqlIsAutoToLower == false &&
  528. this.Context.CurrentConnectionConfig.MoreSettings?.PgSqlIsAutoToLowerCodeFirst == false)
  529. {
  530. return false;
  531. }
  532. else
  533. {
  534. return true;
  535. }
  536. }
  537. }
  538. private string GetSchema()
  539. {
  540. var schema = "public";
  541. if (System.Text.RegularExpressions.Regex.IsMatch(this.Context.CurrentConnectionConfig.ConnectionString.ToLower(), "searchpath="))
  542. {
  543. var regValue = System.Text.RegularExpressions.Regex.Match(this.Context.CurrentConnectionConfig.ConnectionString.ToLower(), @"searchpath\=(\w+)").Groups[1].Value;
  544. if (regValue.HasValue())
  545. {
  546. schema = regValue;
  547. }
  548. }
  549. else if (System.Text.RegularExpressions.Regex.IsMatch(this.Context.CurrentConnectionConfig.ConnectionString.ToLower(), "search path="))
  550. {
  551. var regValue = System.Text.RegularExpressions.Regex.Match(this.Context.CurrentConnectionConfig.ConnectionString.ToLower(), @"search path\=(\w+)").Groups[1].Value;
  552. if (regValue.HasValue())
  553. {
  554. schema = regValue;
  555. }
  556. }
  557. return schema;
  558. }
  559. private static void ConvertCreateColumnInfo(DbColumnInfo x)
  560. {
  561. string[] array = new string[] { "int4", "text", "int2", "int8", "date", "bit", "text", "timestamp" };
  562. if (array.Contains(x.DataType?.ToLower()))
  563. {
  564. x.Length = 0;
  565. x.DecimalDigits = 0;
  566. }
  567. }
  568. #endregion
  569. }
  570. }