Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQuirreL Plugin Tutorial

I have an idea for a plugin for SQuirreL SQL client and I'd like to know how to make a plugin. My plugin will be a query builder UI which needs access to the schema model including tables, columns, primary keys, foreign keys and constraints etc.

I have searched the web for SQurreL plugin information / tutorials and I can't find much. The best I can find is on Wikipedia which is quite brief.

  • http://squirrel-sql.sourceforge.net/index.php?page=plugins
  • http://en.wikipedia.org/wiki/SQuirreL_SQL_Client_Plugin_API

If you have any links, tutorials, examples or any other information on creating SQuirreL plugins, please post them here.

Thanks

like image 480
lance-java Avatar asked Mar 05 '14 14:03

lance-java


People also ask

How do I run a SQuirreL file in SQL?

To start interacting with the database that you've connected to, double-click its name in SQuirreL SQL's Aliases window. This will open a new session. You can have multiple sessions open at the same time in SQuirreL SQL, each one connected to a different database.

What type of SQL does SQuirreL use?

SQuirreL SQL Client is a program written in Java that allows you to view the contents of a database, issue SQL commands, and as you will see, perform a number of other functions. The graphical front end is built to support JDBC-compliant databases. This article demonstrates SQuirreL being used with DB2 UDB.


1 Answers

Here is a class for extending a Squirrel Plugin made in Java:

public class FulltextsearchPlugin extends DefaultSessionPlugin {  
private final Analyzer analyzer = new StandardAnalyzer();  
private final String path = "c:/temp/lucene/squirrel/";  
private final IndexWriter writer = createIndexWriter();  

@Override  
public String getAuthor() {  
    return "Mike Haller";  
}  

@Override  
public String getDescriptiveName() {  
    return "Full-Text Search Plugin";  
}  

@Override  
public String getInternalName() {  
    return "fulltextsearchplugin";  
}  

@Override  
public String getVersion() {  
    return "0.0.1";  
}  

@Override  
public PluginSessionCallback sessionStarted(ISession session) {  
    // Add context menu items to the object tree's view and procedure nodes.  
    IObjectTreeAPI otApi = session.getSessionInternalFrame()  
            .getObjectTreeAPI();  
    otApi.addToPopup(DatabaseObjectType.TABLE, new FulltextsearchMenu(this,  
            session));  
    return new PluginSessionCallbackAdaptor(this);  
 }  
}  

That is a code snapshot from one of the best tutorials in my view, which provides a very clear discussion with steps on how to get a plugin implemented. The material provides a good template to extend it to other cases.

like image 147
Avanz Avatar answered Oct 19 '22 08:10

Avanz