To Open a MySQL *.sql File
Use the File > Open command and choose MySQL (*.sql)
from the File of type list,
or drag and drop a given *.sql file into the main GS-Base window.
Data from *.sql files can also be accessed via the Add Table and Merge Records commands.
The *.sql dump file must use the INSERT INTO command and must include the preceding table definitions.
The preferable method of saving data in binary BLOB type fields is hexadecimal (ASCII text).
If data is saved in BLOB fields directly as binary streams, GS-Base decodes the following escape sequences:
\0, \n, \r, \, ', ", \z
To Save a MySQL *.sql File
If the open database is already in the *.sql format, the Save command causes saving it back to the same file using the same, original table (field, keys) definitions. Character sets are converted to utf8mb4.
If the current format is not MySQL *.sql, use the File > Save Database Copy As or File > Save Recordset As commands and choose MySQL (*.sql) from the File of type list. In this case, the newly created MySQL table definitions will follow the rules specified in Notes below.
Notes
-
When editing existing MySQL *.sql files and saving them in this format, GS-Base preserves
MySQL table (field, keys) definitions, except that used characters are converted to utf8mb4.
New fields added to such a file in GS-Base are subject to the rules listed below. -
MySQL numeric fields become Number fields in GS-Base.
The Number GS-Base fields are exported to new MySQL *.sql files as DOUBLE fields. -
MySQL CHAR and VARCHAR fields shorter than 8162 bytes become Text fields in GS-Base.
GS-Base Text fields are saved as MySQL VARCHAR(255), but no truncation is performed for data within the range 256-8162. -
MySQL VARCHAR fields longer than 8162 bytes, and all MySQL [...]TEXT fields, are used in GS-Base as Long Text fields.
GS-Base Long Text fields are saved as MySQL LONGTEXT fields. -
The binary MySQL BLOB field contents from *.sql files not created by GS-Base are represented
in GS-Base (in Images/Files fields) by files with the "sql_blob.bin" name.
Data from GS-Base Images/Files fields containing just one such object will be saved back to the MySQL file as the same, original binary MySQL contents.
If a GS-Base Images/Files field contains more than one inserted object, or the object name is not "sql_blob.bin", the resulting MySQL BLOB field will contain binary data representing the list of these objects in the following format:- 36-character GS-Base GUID string:
EBDA2E02-5502-43C4-AF43-44EEF3375275 - a repeating list of the elements:
- 5 ASCII characters representing the object/file name length,
- the file name,
- 12 ASCII characters representing the object/file data length,
- the file contents
- 36-character GS-Base GUID string:
-
Files saved by GS-Base require the MySQL system max_allowed_packet
variable to be at least (approx.) 64MB. This is the default value for MySQL 8.0.
If some of your saved MySQL single BLOB/Text fields contain more data, this variable must be increased accordingly. - If a file in the MySQL *.sql format is opened, the Database Explorer tree also displays the SQL field definitions along with the corresponding GS-Base field types.
To automatically resize the column widths to fit the field contents in the opened file, select the Options > General > Auto-fit column widths in imported files option. Keep in mind that for very large files this may slow down the import process. To optimize the resizing, in the Options > General dialog box, increase the declared number of processor cores that GS-Base can use.
Related Topics
Saving PDF files
Opening and saving text files
Opening and saving HTML files
Opening and saving Excel workbooks