我有一个Access数据库,其中包含(在理论上)在“设计视图”中可见的字段描述。我没有访问权限副本。我可以使用mdbtools导出数据和架构,但是描述中没有。有没有办法以编程方式提取这些描述?
答案 0 :(得分:1)
结果是,有一个未公开/未记录在案的mdbutils命令将为表mdb-prop
提供元数据。这是一个Shell脚本,它将列出每个字段的元数据,改编自我忘记了其出处的脚本:
#!/usr/bin/env bash
# Usage: mdb-export-all.sh full-path-to-db
command -v mdb-tables >/dev/null 2>&1 || {
echo >&2 "I require mdb-tables but it's not installed. Aborting.";
exit 1;
}
command -v mdb-export >/dev/null 2>&1 || {
echo >&2 "I require mdb-export but it's not installed. Aborting.";
exit 1;
}
fullfilename=$1
filename=$(basename "$fullfilename")
dbname=${filename%.*}
mkdir "$dbname"
IFS=$'\n'
for table in $(mdb-tables -1 "$fullfilename"); do
echo "Check table $table"
# Save a file with with all metadata for every field
mdb-prop "$fullfilename" "$table" > "$dbname/$table.txt"
# Save a file with with just the descriptions:
cat "$dbname/$table.txt" | grep -E 'name|Description' > "$dbname/info_$table.txt"
done