/// <summary> /// Build custom query to return file attachments with URL from meta values /// </summary> /// <param name="schema">IWpDbSchema</param> /// <param name="fileIds">Attachment IDs</param> /// <param name="virtualUploadsUrl">Virtual Uploads URL for building URLs</param> internal static Maybe <string> GetQuery(IWpDbSchema schema, IImmutableList <WpPostId> fileIds, string virtualUploadsUrl) { // Check for empty list if (fileIds.Count == 0) { return(F.None <string, M.NoFileIdsMsg>()); } // Build query return ("SELECT " + $"`p`.`{schema.Posts.Id}` AS '{nameof(PostAttachment.Id)}', " + $"`p`.`{schema.Posts.Title}` AS '{nameof(PostAttachment.Title)}', " + $"`p`.`{schema.Posts.Excerpt}` AS '{nameof(PostAttachment.Description)}', " + $"`p`.`{schema.Posts.Url}` AS '{nameof(PostAttachment.Url)}', " + $"`pm`.`{schema.PostsMeta.Value}` AS '{nameof(PostAttachment.UrlPath)}', " + $"CONCAT('{virtualUploadsUrl.EndWith('/')}', `pm`.`{schema.PostsMeta.Value}`) AS '{nameof(PostAttachment.Url)}' " + $"FROM `{schema.Posts}` AS `p` " + $"LEFT JOIN `{schema.PostsMeta}` AS `pm` ON `p`.`{schema.Posts.Id}` = `pm`.`{schema.PostsMeta.PostId}` " + $"WHERE `p`.`{schema.Posts.Id}` IN ({string.Join(',', fileIds.Select(x => x.Value))}) " + $"AND `pm`.`{schema.PostsMeta.Key}` = '{Constants.Attachment}';" ); }
/// <summary> /// Allow Builder to be injected /// </summary> /// <param name="schema">IWpDbSchema</param> /// <param name="builder">IQueryPostsTaxonomyPartsBuilder</param> internal PostsTaxonomyOptions(IWpDbSchema schema, IQueryPostsTaxonomyPartsBuilder builder) : base(schema, builder) { }
/// <summary> /// Internal creation only /// </summary> /// <param name="schema">IWpDbSchema</param> internal PostsTaxonomyOptions(IWpDbSchema schema) : base(schema, new PostsTaxonomyPartsBuilder(schema)) { }
public TestPartsBuilder(IExtract extract, IDbClient client, IWpDbSchema schema) : base(extract, client, schema) { Table = Substitute.For <ITable>(); IdColumn = Substitute.For <IColumn>(); }
/// <summary> /// Internal creation only /// </summary> /// <param name="extract">IExtract</param> /// <param name="schema">IWpDbSchema</param> internal PostsMetaPartsBuilder(IExtract extract, IWpDbSchema schema) : base(extract, schema) { }
/// <summary> /// Internal creation only /// </summary> /// <param name="schema">IWpDbSchema</param> internal PostsMetaPartsBuilder(IWpDbSchema schema) : base(schema) { }
/// <summary> /// Internal creation only /// </summary> /// <param name="schema">IWpDbSchema</param> internal PostsOptions(IWpDbSchema schema) : base(schema, new PostsPartsBuilder(schema)) { }
/// <summary> /// Internal creation only /// </summary> /// <param name="extract">IExtract</param> /// <param name="schema">IWpDbSchema</param> internal TermsPartsBuilder(IExtract extract, IWpDbSchema schema) : base(extract, schema) { }
/// <summary> /// Internal creation only /// </summary> /// <param name="schema">IWpDbSchema</param> internal TermsPartsBuilder(IWpDbSchema schema) : base(schema) { }
/// <summary> /// Internal creation only /// </summary> /// <param name="schema">IWpDbSchema</param> internal TermsOptions(IWpDbSchema schema) : base(schema, new TermsPartsBuilder(schema)) { }
/// <summary> /// Allow Builder to be injected /// </summary> /// <param name="schema">IWpDbSchema</param> /// <param name="builder">IQueryTermsPartsBuilder</param> internal TermsOptions(IWpDbSchema schema, IQueryTermsPartsBuilder builder) : base(schema, builder) { }
/// <summary> /// Internal creation only /// </summary> /// <param name="extract">IExtract</param> /// <param name="schema">IWpDbSchema</param> internal PostsTaxonomyPartsBuilder(IExtract extract, IWpDbSchema schema) : base(extract, schema) { }
/// <summary> /// Internal creation only /// </summary> /// <param name="schema">IWpDbSchema</param> internal PostsTaxonomyPartsBuilder(IWpDbSchema schema) : base(schema) { }
public TestOptions(IWpDbSchema schema, IQueryPartsBuilder <TestId> builder) : base(schema, builder) { }
/// <summary> /// Allow Builder to be injected /// </summary> /// <param name="schema">IWpDbSchema</param> /// <param name="builder">IQueryPostsMetaPartsBuilder</param> internal PostsMetaOptions(IWpDbSchema schema, IQueryPostsMetaPartsBuilder builder) : base(schema, builder) =>
/// <summary> /// Internal creation only /// </summary> /// <param name="schema">IWpDbSchema</param> internal PostsMetaOptions(IWpDbSchema schema) : this(schema, new PostsMetaPartsBuilder(schema)) { }