sql revision 309848
1219820Sjeff
2219820Sjeff#------------------------------------------------------------------------------
3219820Sjeff# $File: sql,v 1.20 2016/07/05 19:49:59 christos Exp $
4219820Sjeff# sql:  file(1) magic for SQL files
5219820Sjeff#
6219820Sjeff# From: "Marty Leisner" <mleisner@eng.mc.xerox.com>
7219820Sjeff# Recognize some MySQL files.
8219820Sjeff# Elan Ruusamae <glen@delfi.ee>, added MariaDB signatures
9219820Sjeff# from https://bazaar.launchpad.net/~maria-captains/maria/5.5/view/head:/support-files/magic
10219820Sjeff#
11219820Sjeff0	beshort			0xfe01		MySQL table definition file
12219820Sjeff>2	byte			x		Version %d
13219820Sjeff>3	byte			0		\b, type UNKNOWN
14219820Sjeff>3	byte			1		\b, type DIAM_ISAM
15219820Sjeff>3	byte			2		\b, type HASH
16219820Sjeff>3	byte			3		\b, type MISAM
17219820Sjeff>3	byte			4		\b, type PISAM
18219820Sjeff>3	byte			5		\b, type RMS_ISAM
19219820Sjeff>3	byte			6		\b, type HEAP
20219820Sjeff>3	byte			7		\b, type ISAM
21219820Sjeff>3	byte			8		\b, type MRG_ISAM
22219820Sjeff>3	byte			9		\b, type MYISAM
23219820Sjeff>3	byte			10		\b, type MRG_MYISAM
24219820Sjeff>3	byte			11		\b, type BERKELEY_DB
25219820Sjeff>3	byte			12		\b, type INNODB
26219820Sjeff>3	byte			13		\b, type GEMINI
27219820Sjeff>3	byte			14		\b, type NDBCLUSTER
28219820Sjeff>3	byte			15		\b, type EXAMPLE_DB
29219820Sjeff>3	byte			16		\b, type CSV_DB
30219820Sjeff>3	byte			17		\b, type FEDERATED_DB
31219820Sjeff>3	byte			18		\b, type BLACKHOLE_DB
32219820Sjeff>3	byte			19		\b, type PARTITION_DB
33219820Sjeff>3	byte			20		\b, type BINLOG
34219820Sjeff>3	byte			21		\b, type SOLID
35219820Sjeff>3	byte			22		\b, type PBXT
36219820Sjeff>3	byte			23		\b, type TABLE_FUNCTION
37219820Sjeff>3	byte			24		\b, type MEMCACHE
38219820Sjeff>3	byte			25		\b, type FALCON
39219820Sjeff>3	byte			26		\b, type MARIA
40219820Sjeff>3	byte			27		\b, type PERFORMANCE_SCHEMA
41219820Sjeff>3	byte			127		\b, type DEFAULT
42219820Sjeff>0x0033	ulong			x		\b, MySQL version %d
43219820Sjeff0	belong&0xffffff00	0xfefe0500	MySQL ISAM index file
44219820Sjeff>3	byte			x		Version %d
45219820Sjeff0	belong&0xffffff00	0xfefe0600	MySQL ISAM compressed data file
46219820Sjeff>3	byte			x		Version %d
47219820Sjeff0	belong&0xffffff00	0xfefe0700	MySQL MyISAM index file
48219820Sjeff>3	byte			x		Version %d
49219820Sjeff>14	beshort			x		\b, %d key parts
50219820Sjeff>16	beshort			x		\b, %d unique key parts
51219820Sjeff>18	byte			x		\b, %d keys
52219820Sjeff>28	bequad			x		\b, %lld records
53219820Sjeff>36	bequad			x		\b, %lld deleted records
54219820Sjeff0	belong&0xffffff00	0xfefe0800	MySQL MyISAM compressed data file
55219820Sjeff>3	byte			x		Version %d
56219820Sjeff0	belong&0xffffff00	0xfefe0900	MySQL Maria index file
57219820Sjeff>3	byte			x		Version %d
58219820Sjeff0	belong&0xffffff00	0xfefe0a00	MySQL Maria compressed data file
59219820Sjeff>3	byte			x		Version %d
60219820Sjeff0	belong&0xffffff00	0xfefe0c00
61219820Sjeff>4	string			MACF		MySQL Maria control file
62219820Sjeff>>3	byte			x		Version %d
63219820Sjeff0	string			\376bin	MySQL replication log,
64219820Sjeff>9	long			x		server id %d
65219820Sjeff>8	byte			1
66219820Sjeff>>13	long			69		\b, MySQL V3.2.3
67219820Sjeff>>>19	string			x		\b, server version %s
68219820Sjeff>>13	long			75		\b, MySQL V4.0.2-V4.1
69219820Sjeff>>>25	string			x		\b, server version %s
70219820Sjeff>8	byte			15		MySQL V5+,
71219820Sjeff>>25	string			x		server version %s
72219820Sjeff>4	string			MARIALOG	MySQL Maria transaction log file
73219820Sjeff>>3	byte			x		Version %d
74219820Sjeff
75219820Sjeff#------------------------------------------------------------------------------
76219820Sjeff# iRiver H Series database file 
77219820Sjeff# From Ken Guest <ken@linux.ie>
78219820Sjeff# As observed from iRivNavi.iDB and unencoded firmware
79219820Sjeff#
80219820Sjeff0   string		iRivDB	iRiver Database file
81219820Sjeff>11  string	>\0	Version %s
82219820Sjeff>39  string		iHP-100	[H Series]
83219820Sjeff
84219820Sjeff#------------------------------------------------------------------------------
85219820Sjeff# SQLite database files
86219820Sjeff# Ken Guest <ken@linux.ie>, Ty Sarna, Zack Weinberg
87219820Sjeff#
88219820Sjeff# Version 1 used GDBM internally; its files cannot be distinguished
89219820Sjeff# from other GDBM files.
90219820Sjeff#
91219820Sjeff# Version 2 used this format:
92219820Sjeff0	string	**\ This\ file\ contains\ an\ SQLite  SQLite 2.x database
93219820Sjeff
94219820Sjeff# Version 3 of SQLite allows applications to embed their own "user version"
95219820Sjeff# number in the database at offset 60.  Later, SQLite added an "application id"
96219820Sjeff# at offset 68 that is preferred over "user version" for indicating the
97219820Sjeff# associated application.
98219820Sjeff#
99219820Sjeff0   string  SQLite\ format\ 3	SQLite 3.x database
100219820Sjeff!:mime	application/x-sqlite3
101219820Sjeff# seldom found extension sqlite3 like in SyncData.sqlite3
102219820Sjeff# db
103219820Sjeff# Avira Antivir use extension "dbe" like in avevtdb.dbe, avguard_tchk.dbe
104219820Sjeff# Unfortunately extension sqlite also used for other databases starting with string
105219820Sjeff# "TTCONTAINER" like in tracks.sqlite contentconsumer.sqlite contentproducerrepository.sqlite
106219820Sjeff# and with string "ZV-zlib" in like extra.sqlite
107219820Sjeff!:ext sqlite/sqlite3/db/dbe
108219820Sjeff>60 belong  =0x5f4d544e  (Monotone source repository)
109219820Sjeff>68 belong  =0x0f055112  (Fossil checkout)
110219820Sjeff>68 belong  =0x0f055113  (Fossil global configuration)
111219820Sjeff>68 belong  =0x0f055111  (Fossil repository)
112219820Sjeff>68 belong  =0x42654462  (Bentley Systems BeSQLite Database)
113219820Sjeff>68 belong  =0x42654c6e  (Bentley Systems Localization File)
114219820Sjeff>68 belong  =0x47504b47  (OGC GeoPackage file)
115219820Sjeff>68 default x
116219820Sjeff>>68 belong  !0          \b, application id %u
117219820Sjeff>>60 belong  !0          \b, user version %d
118219820Sjeff>96 belong  x            \b, last written using SQLite version %d
119219820Sjeff
120219820Sjeff
121219820Sjeff# SQLite Write-Ahead Log from SQLite version >= 3.7.0
122219820Sjeff# http://www.sqlite.org/fileformat.html#walformat
123219820Sjeff0	belong&0xfffffffe	0x377f0682	SQLite Write-Ahead Log,
124219820Sjeff!:ext sqlite-wal/db-wal
125219820Sjeff>4	belong	x	version %d
126219820Sjeff
127219820Sjeff# SQLite Rollback Journal
128219820Sjeff# http://www.sqlite.org/fileformat.html#rollbackjournal
129219820Sjeff0	string	\xd9\xd5\x05\xf9\x20\xa1\x63\xd7	SQLite Rollback Journal
130219820Sjeff
131219820Sjeff# Panasonic channel list database svl.bin or svl.db added by Joerg Jenderek
132219820Sjeff# https://github.com/PredatH0r/ChanSort
133219820Sjeff0	string		PSDB\0			Panasonic channel list DataBase
134219820Sjeff!:ext db/bin
135219820Sjeff#!:mime	application/x-db-svl-panasonic
136219820Sjeff>126	string		SQLite\ format\ 3	
137219820Sjeff#!:mime	application/x-panasonic-sqlite3
138219820Sjeff>>&-15	indirect	x			\b; contains 
139219820Sjeff
140219820Sjeff# H2 Database from http://www.h2database.com/
141219820Sjeff0	string		--\ H2\ 0.5/B\ --\ \n	H2 Database file
142219820Sjeff