If you want to assign a user-defined field for a digital resource, you should make_object first, assign the field, and then use the add procedure. Note that if you want to add a digital resource to the database, you will have to add all parents as well.
declare @now t_time_value
declare @today t_date_value
set @now = getdate()
set @today = getdate()
exec sp_sql_add_dr
@name =’Test’,
@location =’*:’,
@size =-1,
@type =’Folder’,
@date_created =@today,
@time_created =@now,
@date_last_modified =@today,
@time_last_modified =@now,
@date_thumbnailed =@today,
@time_thumbnailed =@now,
@thumbnail_method =4,
@mac_creator =’AAAA’,
@mac_type =’AAAA’
exec sp_sql_add_dr
@name =’Folder’,
@location =’*:Test:’,
@size =-1,
@type =’Folder’,
@date_created =@today,
@time_created =@now,
@date_last_modified =@today,
@time_last_modified =@now,
@date_thumbnailed =@today,
@time_thumbnailed =@now,
@thumbnail_method =4,
@mac_creator =’AAAA’,
@mac_type =’AAAA’
exec sp_sql_add_dr
@name =’My File’,
@location =’*:Test:Folder:’,
@size =1111,
@type =’Unknown’,
@date_created =@today,
@time_created =@now,
@date_last_modified =@today,
@time_last_modified =@now,
@date_thumbnailed =@today,
@time_thumbnailed =@now,
@thumbnail_method =4,
@mac_creator =’AAAA’,
@mac_type =’AAAA’
@keywords - keywords
@thumbnail - thumbnail
@extended_info - extended information of digital resource in XML format
@ext_preview_format - the format in which the extended preview is saved. (i.e. JPG)
@keywords, @thumbnail, and @extended_info are BLOB parameters. Microsoft SQL Server BLOBs cannot be local variables, so it may not be convenient to use these parameters directly. Because of this, the @keywords_info, @thumbnail_info, and @extended_info_location parameters have been added. They do not contain real keywords, thumbnails, or extended information, but they do “know” where these values are located.
--Execute stored procedure at beginning of this section first
declare @now t_time_value
declare @today t_date_value
declare @file_info_id integer
set @now = getdate()
set @today = getdate()
exec sp_sql_add_dr
@name =’File with Extended Preview’,
@location =’*:Test:Folder:’,
@size =1111,
@type =’JPG’,
@date_created =@today,
@time_created =@now,
@date_last_modified =@today,
@time_last_modified =@now,
@date_thumbnailed =@today,
@time_thumbnailed =@now,
@thumbnail_method =2,
@mac_creator =’8BIM’,
@mac_type =’JPEG’,
@keywords_info = ’keywords from dr_file_infos
where file_info_id = 207’,
@thumbnail_info = ’thumbnail from
dr_file_previews where file_info_id = 207’,
@extended_info_location= ’extended_info from
dr_file_infos where file_info_id = 207’,
@ext_preview_format = ’JPG’
select
@file_info_id = file_info_id
from
dr_file_infos
where
name =’File with Extended Preview’ and
location =’*:Test:Folder:’
exec sp_sql_add_extended_preview_page
@file_info_id =@file_info_id,
@page_number =1,
@picture_data_location=’picture_data from
dr_file_extended_previews where page_number = 1 and
file_info_id =207’
Extended preview images are added using sp_sql_add_extended_preview_page. There can be several pages to an extended preview. To add these, execute the code listed above.