Thread: Default extension for sql scripts

Default extension for sql scripts

From
"Florian G. Pflug"
Date:
Hi

If I save a sql script from the query window, shouldn't ".sql" be added
automatically
to the filename? It isn't added on osx as I just noticed - which got me
wondering
if it is added on other platforms. So - how are things on win32 or linux?

On a related note - Does it work on windows to double-click  a saved query,
and have pgadmin3 start _and_ open the query in a query window? I'd like
to add the feature to the osx version. My last Info.plist update was the
first
step for that - pgadmin now even opens when double-clicking the query,
but it doesn't open the query itself. Of course, this only works if the file
is named .sql, which is the reason for my first question.

greetings, Florian Pflug

Re: Default extension for sql scripts

From
Andreas Pflug
Date:
Florian G. Pflug wrote:
> Hi
>
> If I save a sql script from the query window, shouldn't ".sql" be added
> automatically
> to the filename? It isn't added on osx as I just noticed - which got me
> wondering
> if it is added on other platforms. So - how are things on win32 or linux?

Works on win32 and Linux, so could be a wxWid/OSX problem.

> On a related note - Does it work on windows to double-click  a saved query,
> and have pgadmin3 start _and_ open the query in a query window?

No, because pgAdmin can't guess from your script which server it should
connect to.

Regards,
Andreas

Re: Default extension for sql scripts

From
"Florian G. Pflug"
Date:
Andreas Pflug wrote:
> Florian G. Pflug wrote:
>
>> If I save a sql script from the query window, shouldn't ".sql" be
>> added automatically
>> to the filename? It isn't added on osx as I just noticed - which got
>> me wondering
>> if it is added on other platforms. So - how are things on win32 or linux?
>
> Works on win32 and Linux, so could be a wxWid/OSX problem.
Hm.. I guess, wx thinks (for historic reasons), that the file -> application
association happens via Type & Creator (Two 4-character codes saved
with each file) on OSX. While it's true that this still works on osx, apple
recommends using extensions now. I'll see if the behaviour of wx can
be switched - if not, are you okey if an #ifdef OSX in the code?

>> On a related note - Does it work on windows to double-click  a saved
>> query,
>> and have pgadmin3 start _and_ open the query in a query window?
>
> No, because pgAdmin can't guess from your script which server it should
> connect to.
Well, thats fixed in 1.4 afaik - one can now switch the db-connection of a
query window, can't one?. The sql-file coul be opened in a query window
  with no
selected connection, and the user could chosse the connection afterwards.
Does this sound reasonable?

Greetings, Florian Pflug

Re: Default extension for sql scripts

From
Dave Page
Date:


On 25/10/05 6:41 pm, "Florian G. Pflug" <fgp@phlo.org> wrote:

> Andreas Pflug wrote:
>> Florian G. Pflug wrote:
>>
>>> If I save a sql script from the query window, shouldn't ".sql" be
>>> added automatically
>>> to the filename? It isn't added on osx as I just noticed - which got
>>> me wondering
>>> if it is added on other platforms. So - how are things on win32 or linux?
>>
>> Works on win32 and Linux, so could be a wxWid/OSX problem.
> Hm.. I guess, wx thinks (for historic reasons), that the file -> application
> association happens via Type & Creator (Two 4-character codes saved
> with each file) on OSX. While it's true that this still works on osx, apple
> recommends using extensions now. I'll see if the behaviour of wx can
> be switched - if not, are you okey if an #ifdef OSX in the code?

That's fine.

>>> On a related note - Does it work on windows to double-click  a saved
>>> query,
>>> and have pgadmin3 start _and_ open the query in a query window?
>>
>> No, because pgAdmin can't guess from your script which server it should
>> connect to.
> Well, thats fixed in 1.4 afaik - one can now switch the db-connection of a
> query window, can't one?. The sql-file coul be opened in a query window
>   with no
> selected connection, and the user could chosse the connection afterwards.
> Does this sound reasonable?

Yes.

BTW, I should really backout your earlier patch until after 1.4-STABLE is
branched - I didn't realise you were starting on new functionality, probably
because I didn't get your original email.

Regards, Dave



Re: Default extension for sql scripts

From
"Florian G. Pflug"
Date:
Dave Page wrote:
>>>>On a related note - Does it work on windows to double-click  a saved
>>>>query,

>>>>and have pgadmin3 start _and_ open the query in a query window?
>>>No, because pgAdmin can't guess from your script which server it should
>>>connect to.

>>Well, thats fixed in 1.4 afaik - one can now switch the db-connection of a
>>query window, can't one?. The sql-file coul be opened in a query window
>>  with no
>>selected connection, and the user could chosse the connection afterwards.
>>Does this sound reasonable?
>
> Yes.
>
> BTW, I should really backout your earlier patch until after 1.4-STABLE is
> branched - I didn't realise you were starting on new functionality, probably
> because I didn't get your original email.

Well, sorry for that, I didn't mean to "sneak the patch in"..
But I didn't plan to submit patches for actually opening a saved query
with a double-click before 1.4 was branched. I just wanted to make
pgAdmin3 announce the extension .sql, and provide an icon for it -
something I more or less consider to be part of "behaving like a good
osx citizen". That pgAdmin3 now actually starts when double-clicking a
saved query (Well, at least if you named your file *.sql) is more a
byproduct of announcing the type in the Info.plist, and providing an Icon.

It's up to you, of course, to decide how to go forward with this.
My plan would be to fix the "add .sql extension to filename" bug
for 1.4, but to leave the "open query with double-click" thing
for 1.4.1 at least. I belive the Info.plist changes I sent are still
ok for 1.4 - even if it's a bit strange that pgadmin will startup on
double-clicking a file, but won't actually open the query. If you
deem that behaviour unacceptably, then I could try to figure out
how to prevent it.

greetings, Florian Pflug

Attachment

Re: Default extension for sql scripts

From
Dave Page
Date:


On 26/10/05 4:56 pm, "Florian G. Pflug" <fgp@phlo.org> wrote:

> Dave Page wrote:
>>>>> On a related note - Does it work on windows to double-click  a saved
>>>>> query,
>
>>>>> and have pgadmin3 start _and_ open the query in a query window?
>>>> No, because pgAdmin can't guess from your script which server it should
>>>> connect to.
>
>>> Well, thats fixed in 1.4 afaik - one can now switch the db-connection of a
>>> query window, can't one?. The sql-file coul be opened in a query window
>>>  with no
>>> selected connection, and the user could chosse the connection afterwards.
>>> Does this sound reasonable?
>>
>> Yes.
>>
>> BTW, I should really backout your earlier patch until after 1.4-STABLE is
>> branched - I didn't realise you were starting on new functionality, probably
>> because I didn't get your original email.
>
> Well, sorry for that, I didn't mean to "sneak the patch in"..

No, I realise that :-)

> But I didn't plan to submit patches for actually opening a saved query
> with a double-click before 1.4 was branched. I just wanted to make
> pgAdmin3 announce the extension .sql, and provide an icon for it -
> something I more or less consider to be part of "behaving like a good
> osx citizen".

Actually I'd say that's precisely what it doesn't do. By associating the
icon, you're allowing the user to open that filetype in pgAdmin. Only it
doesn't. If you leave it un-associated, at least the finder will ask them
what app to open it in so they can do something useful.

> That pgAdmin3 now actually starts when double-clicking a
> saved query (Well, at least if you named your file *.sql) is more a
> byproduct of announcing the type in the Info.plist, and providing an Icon.
>
> It's up to you, of course, to decide how to go forward with this.
> My plan would be to fix the "add .sql extension to filename" bug

Oh, I do intend to look at that. I'm in Japan with Andreas at the moment as
it happens, and expect to have some time to look at some mac issues like
this.

> for 1.4, but to leave the "open query with double-click" thing
> for 1.4.1 at least.

It'll be for 1.5 (which will eventually be released as 1.6. We don't add any
new features to point releases.

> I belive the Info.plist changes I sent are still
> ok for 1.4 - even if it's a bit strange that pgadmin will startup on
> double-clicking a file, but won't actually open the query. If you
> deem that behaviour unacceptably, then I could try to figure out
> how to prevent it.

Well for no I just rolled back the info.plist changes, and left the makefile
changes and the extra file in place. I guess that should do the job for now.

Regards, Dave



Re: Default extension for sql scripts

From
"Florian G. Pflug"
Date:
Dave Page wrote:
 >>But I didn't plan to submit patches for actually opening a saved query
 >>with a double-click before 1.4 was branched. I just wanted to make
 >>pgAdmin3 announce the extension .sql, and provide an icon for it -
 >>something I more or less consider to be part of "behaving like a good
 >>osx citizen".
 >
 > Actually I'd say that's precisely what it doesn't do. By associating the
 > icon, you're allowing the user to open that filetype in pgAdmin. Only it
 > doesn't. If you leave it un-associated, at least the finder will ask them
 > what app to open it in so they can do something useful.

Hm... you're right, I guess.

 >>I belive the Info.plist changes I sent are still
 >>ok for 1.4 - even if it's a bit strange that pgadmin will startup on
 >>double-clicking a file, but won't actually open the query. If you
 >>deem that behaviour unacceptably, then I could try to figure out
 >>how to prevent it.
 >
 > Well for no I just rolled back the info.plist changes, and left the
makefile
 > changes and the extra file in place. I guess that should do the job
for now.
If you rolled back the Info.plist changes, you should revert the
Makefile.am,
and remove the sql.icns file too - or at least revert the Makefile.am,
so that the
sql.icns file doesn't get installed anymore.

Leaving the sql.icns file there does _not_ associate it with .sql files,
if thats
what you want to accomplish by reverting the Info.plist, and leaving the
file there.
The binding of sql.icns <-> .sql extension happens in the Infoo.plist file.

Attached is a new Info.plist file that _prevents_ pgadmin3 from opening when
a user double-clicks a sql-file. It still announces the icon, and still
has it's version
set to 1.4. Would you consider using that for 1.4?

Greetings, Florian  Pflug

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeExtensions</key>
            <array>
                <string>sql</string>
            </array>
            <key>CFBundleTypeIconFile</key>
            <string>sql.icns</string>
            <key>CFBundleTypeName</key>
            <string>pgAdmin3 SQL Query</string>
            <key>CFBundleTypeRole</key>
            <string>None</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>org.postgresql.pgadmin.sql</string>
            </array>
        </dict>
    </array>
    <key>CFBundleExecutable</key>
    <string>pgAdmin3</string>
    <key>CFBundleGetInfoString</key>
    <string>pgAdmin3 1.4</string>
    <key>CFBundleIconFile</key>
    <string>pgAdmin3.icns</string>
    <key>CFBundleIdentifier</key>
    <string>org.postgresql.pgadmin</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.4</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1.4</string>
    <key>CSResourcesFileMapped</key>
    <true/>
    <key>UTExportedTypeDeclarations</key>
    <array>
        <dict>
            <key>UTTypeConformsTo</key>
            <array>
                <string>public.utf8-plain-text</string>
            </array>
            <key>UTTypeDescription</key>
            <string>pgAdmin3 SQL Query</string>
            <key>UTTypeIconFile</key>
            <string>sql.icns</string>
            <key>UTTypeIdentifier</key>
            <string>org.postgresql.pgadmin.sql</string>
            <key>UTTypeTagSpecification</key>
            <dict>
                <key>public.filename-extension</key>
                <array>
                    <string>sql</string>
                </array>
            </dict>
        </dict>
    </array>
</dict>
</plist>

Re: Default extension for sql scripts

From
Dave Page
Date:


On 27/10/05 11:49 am, "Florian G. Pflug" <fgp@phlo.org> wrote:

> Attached is a new Info.plist file that _prevents_ pgadmin3 from opening when
> a user double-clicks a sql-file. It still announces the icon, and still
> has it's version
> set to 1.4. Would you consider using that for 1.4?

Thanks Florian, comitted to SVN.

Regards, Dave