1111658Sobrien
2111658Sobrien#------------------------------------------------------------------------------
3354939Sdelphij# $File: sql,v 1.22 2019/04/19 00:42:27 christos Exp $
4111658Sobrien# sql:  file(1) magic for SQL files
5111658Sobrien#
6111658Sobrien# From: "Marty Leisner" <mleisner@eng.mc.xerox.com>
7111658Sobrien# Recognize some MySQL files.
8267843Sdelphij# Elan Ruusamae <glen@delfi.ee>, added MariaDB signatures
9267843Sdelphij# from https://bazaar.launchpad.net/~maria-captains/maria/5.5/view/head:/support-files/magic
10111658Sobrien#
11111658Sobrien0	beshort			0xfe01		MySQL table definition file
12111658Sobrien>2	byte			x		Version %d
13309847Sdelphij>3	byte			0		\b, type UNKNOWN
14309847Sdelphij>3	byte			1		\b, type DIAM_ISAM
15309847Sdelphij>3	byte			2		\b, type HASH
16309847Sdelphij>3	byte			3		\b, type MISAM
17309847Sdelphij>3	byte			4		\b, type PISAM
18309847Sdelphij>3	byte			5		\b, type RMS_ISAM
19309847Sdelphij>3	byte			6		\b, type HEAP
20309847Sdelphij>3	byte			7		\b, type ISAM
21309847Sdelphij>3	byte			8		\b, type MRG_ISAM
22309847Sdelphij>3	byte			9		\b, type MYISAM
23309847Sdelphij>3	byte			10		\b, type MRG_MYISAM
24309847Sdelphij>3	byte			11		\b, type BERKELEY_DB
25309847Sdelphij>3	byte			12		\b, type INNODB
26309847Sdelphij>3	byte			13		\b, type GEMINI
27309847Sdelphij>3	byte			14		\b, type NDBCLUSTER
28309847Sdelphij>3	byte			15		\b, type EXAMPLE_DB
29309847Sdelphij>3	byte			16		\b, type CSV_DB
30309847Sdelphij>3	byte			17		\b, type FEDERATED_DB
31309847Sdelphij>3	byte			18		\b, type BLACKHOLE_DB
32309847Sdelphij>3	byte			19		\b, type PARTITION_DB
33309847Sdelphij>3	byte			20		\b, type BINLOG
34309847Sdelphij>3	byte			21		\b, type SOLID
35309847Sdelphij>3	byte			22		\b, type PBXT
36309847Sdelphij>3	byte			23		\b, type TABLE_FUNCTION
37309847Sdelphij>3	byte			24		\b, type MEMCACHE
38309847Sdelphij>3	byte			25		\b, type FALCON
39309847Sdelphij>3	byte			26		\b, type MARIA
40309847Sdelphij>3	byte			27		\b, type PERFORMANCE_SCHEMA
41309847Sdelphij>3	byte			127		\b, type DEFAULT
42309847Sdelphij>0x0033	ulong			x		\b, MySQL version %d
43309847Sdelphij0	belong&0xffffff00	0xfefe0500	MySQL ISAM index file
44309847Sdelphij>3	byte			x		Version %d
45309847Sdelphij0	belong&0xffffff00	0xfefe0600	MySQL ISAM compressed data file
46309847Sdelphij>3	byte			x		Version %d
47267843Sdelphij0	belong&0xffffff00	0xfefe0700	MySQL MyISAM index file
48111658Sobrien>3	byte			x		Version %d
49309847Sdelphij>14	beshort			x		\b, %d key parts
50309847Sdelphij>16	beshort			x		\b, %d unique key parts
51309847Sdelphij>18	byte			x		\b, %d keys
52309847Sdelphij>28	bequad			x		\b, %lld records
53309847Sdelphij>36	bequad			x		\b, %lld deleted records
54267843Sdelphij0	belong&0xffffff00	0xfefe0800	MySQL MyISAM compressed data file
55111658Sobrien>3	byte			x		Version %d
56267843Sdelphij0	belong&0xffffff00	0xfefe0900	MySQL Maria index file
57267843Sdelphij>3	byte			x		Version %d
58309847Sdelphij0	belong&0xffffff00	0xfefe0a00	MySQL Maria compressed data file
59267843Sdelphij>3	byte			x		Version %d
60267843Sdelphij0	belong&0xffffff00	0xfefe0c00
61267843Sdelphij>4	string			MACF		MySQL Maria control file
62267843Sdelphij>>3	byte			x		Version %d
63309847Sdelphij0	string			\376bin	MySQL replication log,
64309847Sdelphij>9	long			x		server id %d
65309847Sdelphij>8	byte			1
66309847Sdelphij>>13	long			69		\b, MySQL V3.2.3
67309847Sdelphij>>>19	string			x		\b, server version %s
68309847Sdelphij>>13	long			75		\b, MySQL V4.0.2-V4.1
69309847Sdelphij>>>25	string			x		\b, server version %s
70309847Sdelphij>8	byte			15		MySQL V5+,
71309847Sdelphij>>25	string			x		server version %s
72309847Sdelphij>4	string			MARIALOG	MySQL Maria transaction log file
73309847Sdelphij>>3	byte			x		Version %d
74159764Sobrien
75159764Sobrien#------------------------------------------------------------------------------
76328874Seadler# iRiver H Series database file
77159764Sobrien# From Ken Guest <ken@linux.ie>
78159764Sobrien# As observed from iRivNavi.iDB and unencoded firmware
79159764Sobrien#
80159764Sobrien0   string		iRivDB	iRiver Database file
81159764Sobrien>11  string	>\0	Version %s
82159764Sobrien>39  string		iHP-100	[H Series]
83159764Sobrien
84159764Sobrien#------------------------------------------------------------------------------
85169962Sobrien# SQLite database files
86169962Sobrien# Ken Guest <ken@linux.ie>, Ty Sarna, Zack Weinberg
87159764Sobrien#
88169962Sobrien# Version 1 used GDBM internally; its files cannot be distinguished
89169962Sobrien# from other GDBM files.
90169962Sobrien#
91169962Sobrien# Version 2 used this format:
92169962Sobrien0	string	**\ This\ file\ contains\ an\ SQLite  SQLite 2.x database
93169962Sobrien
94169962Sobrien# Version 3 of SQLite allows applications to embed their own "user version"
95267843Sdelphij# number in the database at offset 60.  Later, SQLite added an "application id"
96267843Sdelphij# at offset 68 that is preferred over "user version" for indicating the
97267843Sdelphij# associated application.
98267843Sdelphij#
99298192Sdelphij0   string  SQLite\ format\ 3	SQLite 3.x database
100298192Sdelphij!:mime	application/x-sqlite3
101298192Sdelphij# seldom found extension sqlite3 like in SyncData.sqlite3
102298192Sdelphij# db
103298192Sdelphij# Avira Antivir use extension "dbe" like in avevtdb.dbe, avguard_tchk.dbe
104298192Sdelphij# Unfortunately extension sqlite also used for other databases starting with string
105298192Sdelphij# "TTCONTAINER" like in tracks.sqlite contentconsumer.sqlite contentproducerrepository.sqlite
106298192Sdelphij# and with string "ZV-zlib" in like extra.sqlite
107298192Sdelphij!:ext sqlite/sqlite3/db/dbe
108298192Sdelphij>60 belong  =0x5f4d544e  (Monotone source repository)
109298192Sdelphij>68 belong  =0x0f055112  (Fossil checkout)
110298192Sdelphij>68 belong  =0x0f055113  (Fossil global configuration)
111298192Sdelphij>68 belong  =0x0f055111  (Fossil repository)
112298192Sdelphij>68 belong  =0x42654462  (Bentley Systems BeSQLite Database)
113298192Sdelphij>68 belong  =0x42654c6e  (Bentley Systems Localization File)
114298192Sdelphij>68 belong  =0x47504b47  (OGC GeoPackage file)
115298192Sdelphij>68 default x
116267843Sdelphij>>68 belong  !0          \b, application id %u
117267843Sdelphij>>60 belong  !0          \b, user version %d
118298192Sdelphij>96 belong  x            \b, last written using SQLite version %d
119169962Sobrien
120298192Sdelphij
121267843Sdelphij# SQLite Write-Ahead Log from SQLite version >= 3.7.0
122354939Sdelphij# https://www.sqlite.org/fileformat.html#walformat
123267843Sdelphij0	belong&0xfffffffe	0x377f0682	SQLite Write-Ahead Log,
124298192Sdelphij!:ext sqlite-wal/db-wal
125267843Sdelphij>4	belong	x	version %d
126267843Sdelphij
127267843Sdelphij# SQLite Rollback Journal
128354939Sdelphij# https://www.sqlite.org/fileformat.html#rollbackjournal
129267843Sdelphij0	string	\xd9\xd5\x05\xf9\x20\xa1\x63\xd7	SQLite Rollback Journal
130267843Sdelphij
131267843Sdelphij# Panasonic channel list database svl.bin or svl.db added by Joerg Jenderek
132298192Sdelphij# https://github.com/PredatH0r/ChanSort
133298192Sdelphij0	string		PSDB\0			Panasonic channel list DataBase
134298192Sdelphij!:ext db/bin
135298192Sdelphij#!:mime	application/x-db-svl-panasonic
136328874Seadler>126	string		SQLite\ format\ 3
137298192Sdelphij#!:mime	application/x-panasonic-sqlite3
138328874Seadler>>&-15	indirect	x			\b; contains
139309847Sdelphij
140354939Sdelphij# H2 Database from https://www.h2database.com/
141309847Sdelphij0	string		--\ H2\ 0.5/B\ --\ \n	H2 Database file
142