xref: /freebsd/contrib/file/magic/Magdir/sql (revision a5d223e641705cbe537d23e5c023395a929ab8da)
1b6cee71dSXin LI
2b6cee71dSXin LI#------------------------------------------------------------------------------
3*a5d223e6SXin LI# $File: sql,v 1.20 2016/07/05 19:49:59 christos Exp $
4b6cee71dSXin LI# sql:  file(1) magic for SQL files
5b6cee71dSXin LI#
6b6cee71dSXin LI# From: "Marty Leisner" <mleisner@eng.mc.xerox.com>
7b6cee71dSXin LI# Recognize some MySQL files.
8b6cee71dSXin LI# Elan Ruusamae <glen@delfi.ee>, added MariaDB signatures
9b6cee71dSXin LI# from https://bazaar.launchpad.net/~maria-captains/maria/5.5/view/head:/support-files/magic
10b6cee71dSXin LI#
11b6cee71dSXin LI0	beshort			0xfe01		MySQL table definition file
12b6cee71dSXin LI>2	byte			x		Version %d
13*a5d223e6SXin LI>3	byte			0		\b, type UNKNOWN
14*a5d223e6SXin LI>3	byte			1		\b, type DIAM_ISAM
15*a5d223e6SXin LI>3	byte			2		\b, type HASH
16*a5d223e6SXin LI>3	byte			3		\b, type MISAM
17*a5d223e6SXin LI>3	byte			4		\b, type PISAM
18*a5d223e6SXin LI>3	byte			5		\b, type RMS_ISAM
19*a5d223e6SXin LI>3	byte			6		\b, type HEAP
20*a5d223e6SXin LI>3	byte			7		\b, type ISAM
21*a5d223e6SXin LI>3	byte			8		\b, type MRG_ISAM
22*a5d223e6SXin LI>3	byte			9		\b, type MYISAM
23*a5d223e6SXin LI>3	byte			10		\b, type MRG_MYISAM
24*a5d223e6SXin LI>3	byte			11		\b, type BERKELEY_DB
25*a5d223e6SXin LI>3	byte			12		\b, type INNODB
26*a5d223e6SXin LI>3	byte			13		\b, type GEMINI
27*a5d223e6SXin LI>3	byte			14		\b, type NDBCLUSTER
28*a5d223e6SXin LI>3	byte			15		\b, type EXAMPLE_DB
29*a5d223e6SXin LI>3	byte			16		\b, type CSV_DB
30*a5d223e6SXin LI>3	byte			17		\b, type FEDERATED_DB
31*a5d223e6SXin LI>3	byte			18		\b, type BLACKHOLE_DB
32*a5d223e6SXin LI>3	byte			19		\b, type PARTITION_DB
33*a5d223e6SXin LI>3	byte			20		\b, type BINLOG
34*a5d223e6SXin LI>3	byte			21		\b, type SOLID
35*a5d223e6SXin LI>3	byte			22		\b, type PBXT
36*a5d223e6SXin LI>3	byte			23		\b, type TABLE_FUNCTION
37*a5d223e6SXin LI>3	byte			24		\b, type MEMCACHE
38*a5d223e6SXin LI>3	byte			25		\b, type FALCON
39*a5d223e6SXin LI>3	byte			26		\b, type MARIA
40*a5d223e6SXin LI>3	byte			27		\b, type PERFORMANCE_SCHEMA
41*a5d223e6SXin LI>3	byte			127		\b, type DEFAULT
42*a5d223e6SXin LI>0x0033	ulong			x		\b, MySQL version %d
43b6cee71dSXin LI0	belong&0xffffff00	0xfefe0500	MySQL ISAM index file
44b6cee71dSXin LI>3	byte			x		Version %d
45b6cee71dSXin LI0	belong&0xffffff00	0xfefe0600	MySQL ISAM compressed data file
46b6cee71dSXin LI>3	byte			x		Version %d
47*a5d223e6SXin LI0	belong&0xffffff00	0xfefe0700	MySQL MyISAM index file
48*a5d223e6SXin LI>3	byte			x		Version %d
49*a5d223e6SXin LI>14	beshort			x		\b, %d key parts
50*a5d223e6SXin LI>16	beshort			x		\b, %d unique key parts
51*a5d223e6SXin LI>18	byte			x		\b, %d keys
52*a5d223e6SXin LI>28	bequad			x		\b, %lld records
53*a5d223e6SXin LI>36	bequad			x		\b, %lld deleted records
54*a5d223e6SXin LI0	belong&0xffffff00	0xfefe0800	MySQL MyISAM compressed data file
55*a5d223e6SXin LI>3	byte			x		Version %d
56*a5d223e6SXin LI0	belong&0xffffff00	0xfefe0900	MySQL Maria index file
57*a5d223e6SXin LI>3	byte			x		Version %d
58*a5d223e6SXin LI0	belong&0xffffff00	0xfefe0a00	MySQL Maria compressed data file
59*a5d223e6SXin LI>3	byte			x		Version %d
60b6cee71dSXin LI0	belong&0xffffff00	0xfefe0c00
61b6cee71dSXin LI>4	string			MACF		MySQL Maria control file
62b6cee71dSXin LI>>3	byte			x		Version %d
63*a5d223e6SXin LI0	string			\376bin	MySQL replication log,
64*a5d223e6SXin LI>9	long			x		server id %d
65*a5d223e6SXin LI>8	byte			1
66*a5d223e6SXin LI>>13	long			69		\b, MySQL V3.2.3
67*a5d223e6SXin LI>>>19	string			x		\b, server version %s
68*a5d223e6SXin LI>>13	long			75		\b, MySQL V4.0.2-V4.1
69*a5d223e6SXin LI>>>25	string			x		\b, server version %s
70*a5d223e6SXin LI>8	byte			15		MySQL V5+,
71*a5d223e6SXin LI>>25	string			x		server version %s
72*a5d223e6SXin LI>4	string			MARIALOG	MySQL Maria transaction log file
73*a5d223e6SXin LI>>3	byte			x		Version %d
74b6cee71dSXin LI
75b6cee71dSXin LI#------------------------------------------------------------------------------
76b6cee71dSXin LI# iRiver H Series database file
77b6cee71dSXin LI# From Ken Guest <ken@linux.ie>
78b6cee71dSXin LI# As observed from iRivNavi.iDB and unencoded firmware
79b6cee71dSXin LI#
80b6cee71dSXin LI0   string		iRivDB	iRiver Database file
81b6cee71dSXin LI>11  string	>\0	Version %s
82b6cee71dSXin LI>39  string		iHP-100	[H Series]
83b6cee71dSXin LI
84b6cee71dSXin LI#------------------------------------------------------------------------------
85b6cee71dSXin LI# SQLite database files
86b6cee71dSXin LI# Ken Guest <ken@linux.ie>, Ty Sarna, Zack Weinberg
87b6cee71dSXin LI#
88b6cee71dSXin LI# Version 1 used GDBM internally; its files cannot be distinguished
89b6cee71dSXin LI# from other GDBM files.
90b6cee71dSXin LI#
91b6cee71dSXin LI# Version 2 used this format:
92b6cee71dSXin LI0	string	**\ This\ file\ contains\ an\ SQLite  SQLite 2.x database
93b6cee71dSXin LI
94b6cee71dSXin LI# Version 3 of SQLite allows applications to embed their own "user version"
95b6cee71dSXin LI# number in the database at offset 60.  Later, SQLite added an "application id"
96b6cee71dSXin LI# at offset 68 that is preferred over "user version" for indicating the
97b6cee71dSXin LI# associated application.
98b6cee71dSXin LI#
993e41d09dSXin LI0   string  SQLite\ format\ 3	SQLite 3.x database
1003e41d09dSXin LI!:mime	application/x-sqlite3
1013e41d09dSXin LI# seldom found extension sqlite3 like in SyncData.sqlite3
1023e41d09dSXin LI# db
1033e41d09dSXin LI# Avira Antivir use extension "dbe" like in avevtdb.dbe, avguard_tchk.dbe
1043e41d09dSXin LI# Unfortunately extension sqlite also used for other databases starting with string
1053e41d09dSXin LI# "TTCONTAINER" like in tracks.sqlite contentconsumer.sqlite contentproducerrepository.sqlite
1063e41d09dSXin LI# and with string "ZV-zlib" in like extra.sqlite
1073e41d09dSXin LI!:ext sqlite/sqlite3/db/dbe
1083e41d09dSXin LI>60 belong  =0x5f4d544e  (Monotone source repository)
1093e41d09dSXin LI>68 belong  =0x0f055112  (Fossil checkout)
1103e41d09dSXin LI>68 belong  =0x0f055113  (Fossil global configuration)
1113e41d09dSXin LI>68 belong  =0x0f055111  (Fossil repository)
1123e41d09dSXin LI>68 belong  =0x42654462  (Bentley Systems BeSQLite Database)
1133e41d09dSXin LI>68 belong  =0x42654c6e  (Bentley Systems Localization File)
1143e41d09dSXin LI>68 belong  =0x47504b47  (OGC GeoPackage file)
1153e41d09dSXin LI>68 default x
116b6cee71dSXin LI>>68 belong  !0          \b, application id %u
117b6cee71dSXin LI>>60 belong  !0          \b, user version %d
1183e41d09dSXin LI>96 belong  x            \b, last written using SQLite version %d
1193e41d09dSXin LI
120b6cee71dSXin LI
121b6cee71dSXin LI# SQLite Write-Ahead Log from SQLite version >= 3.7.0
122b6cee71dSXin LI# http://www.sqlite.org/fileformat.html#walformat
123b6cee71dSXin LI0	belong&0xfffffffe	0x377f0682	SQLite Write-Ahead Log,
1243e41d09dSXin LI!:ext sqlite-wal/db-wal
125b6cee71dSXin LI>4	belong	x	version %d
126b6cee71dSXin LI
127b6cee71dSXin LI# SQLite Rollback Journal
128b6cee71dSXin LI# http://www.sqlite.org/fileformat.html#rollbackjournal
129b6cee71dSXin LI0	string	\xd9\xd5\x05\xf9\x20\xa1\x63\xd7	SQLite Rollback Journal
130b6cee71dSXin LI
131b6cee71dSXin LI# Panasonic channel list database svl.bin or svl.db added by Joerg Jenderek
1323e41d09dSXin LI# https://github.com/PredatH0r/ChanSort
1333e41d09dSXin LI0	string		PSDB\0			Panasonic channel list DataBase
1343e41d09dSXin LI!:ext db/bin
1353e41d09dSXin LI#!:mime	application/x-db-svl-panasonic
136b6cee71dSXin LI>126	string		SQLite\ format\ 3
1373e41d09dSXin LI#!:mime	application/x-panasonic-sqlite3
138b6cee71dSXin LI>>&-15	indirect	x			\b; contains
139*a5d223e6SXin LI
140*a5d223e6SXin LI# H2 Database from http://www.h2database.com/
141*a5d223e6SXin LI0	string		--\ H2\ 0.5/B\ --\ \n	H2 Database file
142