Shooter7119 / sequel-pro

Automatically exported from code.google.com/p/sequel-pro
Other
0 stars 0 forks source link

[REQ] add .sql.gz or .sql.bz2 as default file ending if the corresponding compression is selected #1367

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If you export a database and compression is selected the file extention should 
reflect that this is not a plain text sql file.
It can be a quite confusing, since some text editors like bbedit show the plain 
text content of the file and others show just garbage.

Original issue reported on code.google.com by orange....@gmail.com on 4 Jun 2012 at 1:15

GoogleCodeExporter commented 9 years ago
This is the current functionality. Are you using the most up to date version of 
Sequel Pro (0.9.9.1)?

Original comment by stuart02 on 5 Jun 2012 at 9:54

GoogleCodeExporter commented 9 years ago
Yes: 0.9.9.1 - Build 3408.

I noticed that the ".sql" was in format string for the filename. I don't think 
I changed that ...
Removing the extension from the format string all together results in no 
extension what so ever.
Leaving a single dot at the end results in the proper extention but with an 
extra dot, e.g.
"127.0.0.1.piwik (05.06.12 - 12-02)..sql.gz"

Original comment by orange....@gmail.com on 5 Jun 2012 at 10:03

GoogleCodeExporter commented 9 years ago
found the corresponding code: 

SPExportFilenameUtilities.m Line 45:
if (![[filename pathExtension] length] && [extension length] > 0) filename = 
[filename stringByAppendingPathExtension:extension];

since there are already many dots in the filename the code assumes that a file 
extension was chosen manually.

I think the two options are to
a) always append the extension
b) have a token for the default extension

Original comment by orange....@gmail.com on 5 Jun 2012 at 10:19

GoogleCodeExporter commented 9 years ago
Spot on, orange.cox, well found - just came here to explain the extension 
logic, but I'm too late :)

The reason that code was added was that we don't really want to override user 
custom extensions, but that doesn't work very well with filenames with dots in 
the filename for other reasons - like dotted date formats.

I like your idea for having a token for the default extension - that provides a 
really neat way of allowing overrides.

Original comment by rowanb@gmail.com on 5 Jun 2012 at 11:03

GoogleCodeExporter commented 9 years ago
The way the token replacement works still confuses me :)

I would think the tokenized string should internally look like this (before 
replacing tokens):

"<#!database#>foo<#!table#>.sql"

So the logic would just be:
- Find the last token in the string
- Take the string that comes behind the token
- Check if that string contains ".something"
 - If yes the file has an extension
- If no get the value of the token that precedes the string
 - If that value ends with a dot append "sql" to the end of the string
 - If the value does not end with a dot append ".sql" to the end of the string

Original comment by schlabbe...@gmail.com on 5 Jun 2012 at 7:13