diff --git a/mozilla/extensions/sql/Makefile.in b/mozilla/extensions/sql/Makefile.in new file mode 100644 index 00000000000..9c2ccf2f955 --- /dev/null +++ b/mozilla/extensions/sql/Makefile.in @@ -0,0 +1,18 @@ +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +DIRS = \ + base \ + pgsql \ + build \ + packager + +ifdef ENABLE_TESTS +DIRS += tests +endif + +include $(topsrcdir)/config/rules.mk diff --git a/mozilla/extensions/sql/base/Makefile.in b/mozilla/extensions/sql/base/Makefile.in new file mode 100644 index 00000000000..88ce8bda970 --- /dev/null +++ b/mozilla/extensions/sql/base/Makefile.in @@ -0,0 +1,11 @@ +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +DIRS = \ + public \ + src \ + resources + +include $(topsrcdir)/config/rules.mk diff --git a/mozilla/extensions/sql/base/public/Makefile.in b/mozilla/extensions/sql/base/public/Makefile.in new file mode 100644 index 00000000000..1c4010ccc99 --- /dev/null +++ b/mozilla/extensions/sql/base/public/Makefile.in @@ -0,0 +1,19 @@ +DEPTH = ../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +MODULE = sql + +XPIDLSRCS = \ + mozISqlConnection.idl \ + mozISqlRequest.idl \ + mozISqlDataSource.idl \ + mozISqlInputStream.idl \ + mozISqlRequestObserver.idl \ + mozISqlResult.idl \ + mozISqlResultEnumerator.idl \ + mozISqlService.idl \ + $(NULL) + +include $(topsrcdir)/config/rules.mk diff --git a/mozilla/extensions/sql/base/public/mozISqlConnection.idl b/mozilla/extensions/sql/base/public/mozISqlConnection.idl new file mode 100644 index 00000000000..3411bde15be --- /dev/null +++ b/mozilla/extensions/sql/base/public/mozISqlConnection.idl @@ -0,0 +1,124 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Jan Varga + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" + +interface mozISqlResult; +interface mozISqlRequest; +interface mozISqlRequestObserver; + +/** + * @status UNDER_REVIEW + */ + +[scriptable, uuid(f16397a4-1ecb-4e08-84f8-27750c04b779)] +interface mozISqlConnection : nsISupports +{ + + readonly attribute AString serverVersion; + + /** + * The most recent error message. + */ + readonly attribute AString errorMessage; + + /** + * The ID of the most recently added record. + */ + readonly attribute long lastID; + + /** + * Set up the connection. + * + * @param aHost The host name. + * @param aPort The port at which the host is listening. + * @param aDatabase The real database name to connect to. + * @param aUsername The username to connect as. + * @param aPassword The password to use in authentification phase. + */ + void init(in AString aHost, + in long aPort, + in AString aDatabase, + in AString aUsername, + in AString aPassword); + + /** + * Execute the query synchronously and return database result. + * + * @param aQuery The query to execute. + */ + mozISqlResult executeQuery(in AString aQuery); + + /** + * Execute the update synchronously and return number of updated rows. + * + * @param aUpdate The update to execute. + */ + long executeUpdate(in AString aUpdate); + + mozISqlRequest asyncExecuteQuery(in AString aQuery, + in nsISupports aContext, + in mozISqlRequestObserver aObserver); + + mozISqlRequest asyncExecuteUpdate(in AString aQuery, + in nsISUpports aContext, + in mozISqlRequestObserver aObserver); + + /** + * Begin transaction. + */ + void beginTransaction(); + + /** + * Commit transaction. + */ + void commitTransaction(); + + /** + * Rollback transaction. + */ + void rollbackTransaction(); + + /** + * Get primary keys. + * + * @param aSchema The schema. + * @param aTable The table name. + */ + mozISqlResult getPrimaryKeys(in AString aSchema, in AString aTable); + +}; diff --git a/mozilla/extensions/sql/base/public/mozISqlDataSource.idl b/mozilla/extensions/sql/base/public/mozISqlDataSource.idl new file mode 100644 index 00000000000..026185f9baf --- /dev/null +++ b/mozilla/extensions/sql/base/public/mozISqlDataSource.idl @@ -0,0 +1,65 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Jan Varga + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" + +interface nsIRDFResource; + +/** + * @status UNDER_REVIEW + */ + +[scriptable, uuid(3c0a954f-b595-46a4-932c-3660f55e2e10)] +interface mozISqlDataSource : nsISupports +{ + + /** + * Retrieve the RDF resource associated with the specified row. + * + * @param aRowIndex The row index. + */ + + nsIRDFResource getResourceAtIndex(in long aRowIndex); + + /** + * Retrieve the index associated with specified RDF resource. + * + * @param aResource The resource. + */ + long getIndexOfResource(in nsIRDFResource aResource); + +}; diff --git a/mozilla/extensions/sql/base/public/mozISqlInputStream.idl b/mozilla/extensions/sql/base/public/mozISqlInputStream.idl new file mode 100644 index 00000000000..2daa6799ae8 --- /dev/null +++ b/mozilla/extensions/sql/base/public/mozISqlInputStream.idl @@ -0,0 +1,52 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Jan Varga + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" + +/** + * @status UNDER_DEVELOPMENT + */ + +[scriptable, uuid(555f2485-ba82-4c5c-9dd2-d801104dc09e)] +interface mozISqlInputStream : nsISupports +{ + + AString getColumnHeader(in long aColumnIndex); + + void setColumnHeader(in long aColumnIndex, in AString aLabel); + +}; diff --git a/mozilla/extensions/sql/base/public/mozISqlRequest.idl b/mozilla/extensions/sql/base/public/mozISqlRequest.idl new file mode 100644 index 00000000000..4230387c127 --- /dev/null +++ b/mozilla/extensions/sql/base/public/mozISqlRequest.idl @@ -0,0 +1,77 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Jan Varga + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" + +interface mozISqlConnection; +interface mozISqlRequestObserver; +interface mozISqlResult; + +/** + * @status UNDER_REVIEW + */ + +[scriptable, uuid(f67cb817-5e07-49ff-aacc-5c80585c5031)] +interface mozISqlRequest : nsISupports +{ + readonly attribute AString errorMessage; + + readonly attribute mozISqlResult result; + + readonly attribute long affectedRows; + + readonly attribute long lastID; + + + readonly attribute AString query; + + readonly attribute nsISupports ctxt; + + readonly attribute mozISqlRequestObserver observer; + + + const long STATUS_NONE = 0; + const long STATUS_EXECUTED = 1; + const long STATUS_COMPLETE = 2; + const long STATUS_ERROR = 3; + const long STATUS_CANCELLED = 4; + + readonly attribute long status; + + void cancel(); + +}; diff --git a/mozilla/extensions/sql/base/public/mozISqlRequestObserver.idl b/mozilla/extensions/sql/base/public/mozISqlRequestObserver.idl new file mode 100644 index 00000000000..bcb41e46495 --- /dev/null +++ b/mozilla/extensions/sql/base/public/mozISqlRequestObserver.idl @@ -0,0 +1,56 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Jan Varga + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" + +interface mozISqlRequest; + +/** + * @status UNDER_REVIEW + */ + +[scriptable, uuid(9e950bc0-e252-41ef-ac6f-3e3c4acd9dd8)] +interface mozISqlRequestObserver : nsISupports +{ + + void onStartRequest(in mozISqlRequest aRequest, + in nsISupports aContext); + + void onStopRequest(in mozISqlRequest aRequest, + in nsISupports aContext); + +}; diff --git a/mozilla/extensions/sql/base/public/mozISqlResult.idl b/mozilla/extensions/sql/base/public/mozISqlResult.idl new file mode 100644 index 00000000000..f2d40f4c6ad --- /dev/null +++ b/mozilla/extensions/sql/base/public/mozISqlResult.idl @@ -0,0 +1,87 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Jan Varga + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" + +interface mozISqlConnection; +interface mozISqlResultEnumerator; +interface mozISqlInputStream; + +/** + * @status UNDER_DEVELOPMENT + */ + +[scriptable, uuid(08c220b0-7140-456a-89e9-c94609a7392d)] +interface mozISqlResult : nsISupports +{ + + readonly attribute mozISqlConnection connection; + + readonly attribute AString query; + + readonly attribute AString tableName; + + readonly attribute long rowCount; + + readonly attribute long columnCount; + + AString getColumnName(in long aColumnIndex); + + long getColumnIndex(in AString aColumnName); + + const long TYPE_STRING = 1; + const long TYPE_INT = 2; + const long TYPE_FLOAT = 3; + const long TYPE_DECIMAL = 4; + const long TYPE_DATE = 5; + const long TYPE_TIME = 6; + const long TYPE_DATETIME = 7; + const long TYPE_BOOL = 8; + + long getColumnType(in long aColumnIndex); + + AString getColumnTypeAsString(in long aColumnIndex); + + long getColumnDisplaySize(in long aColumnIndex); + + mozISqlResultEnumerator enumerate(); + + mozISqlInputStream open(); + + void reload(); + +}; diff --git a/mozilla/extensions/sql/base/public/mozISqlResultEnumerator.idl b/mozilla/extensions/sql/base/public/mozISqlResultEnumerator.idl new file mode 100644 index 00000000000..18b1fda8e1b --- /dev/null +++ b/mozilla/extensions/sql/base/public/mozISqlResultEnumerator.idl @@ -0,0 +1,126 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Jan Varga + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" + +interface nsIVariant; + +/** + * @status UNDER_DEVELOPMENT + */ + +[scriptable, uuid(dcc0d29e-2b44-460e-b39f-89121ff8b963)] +interface mozISqlResultEnumerator : nsISupports +{ + + readonly attribute AString errorMessage; + + boolean next(); + + boolean previous(); + + void beforeFirst(); + + void first(); + + void last(); + + void relative(in long aRows); + + void absolute(in long aRowIndex); + + + boolean isNull(in long aColumnIndex); + + nsIVariant getVariant(in long aColumnIndex); + + AString getString(in long aColumnIndex); + + long getInt(in long aColumnIndex); + + float getFloat(in long aColumnIndex); + + float getDecimal(in long aColumnIndex); + + long long getDate(in long aColumnIndex); + + boolean getBool(in long aColumnIndex); + + + void setNull(in long aColumnIndex); + + void setDefault(in long aColumnIndex); + + void copy(in long aColumnIndex); + + void setVariant(in long aColumnIndex, in nsIVariant aValue); + + void setString(in long aColumnIndex, in AString aValue); + + void setInt(in long aColumnIndex, in long aValue); + + void setFloat(in long aColumnIndex, in float aValue); + + void setDecimal(in long aColumnIndex, in float aValue); + + void setDate(in long aColumnIndex, in long long aValue); + + void setBool(in long aColumnIndex, in boolean aValue); + + + void setNullValues(); + + void setDefaultValues(); + + void copyValues(); + + + boolean canInsert(); + + boolean canUpdate(); + + boolean canDelete(); + + long insertRow(); + + long updateRow(); + + long deleteRow(); + + readonly attribute AString currentCondition; + +}; diff --git a/mozilla/extensions/sql/base/public/mozISqlService.idl b/mozilla/extensions/sql/base/public/mozISqlService.idl new file mode 100644 index 00000000000..b46e34d3104 --- /dev/null +++ b/mozilla/extensions/sql/base/public/mozISqlService.idl @@ -0,0 +1,81 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Jan Varga + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" + +interface mozISqlConnection; + +/** + * @status UNDER_DEVELOPMENT + */ + +[scriptable, uuid(1ceb35b7-daa8-4ce4-ac67-125fb17cb019)] +interface mozISqlService : nsISupports +{ + + readonly attribute AString errorMessage; + + void addAlias(in ACString aURI, + in AString aName, + in AString aType, + in AString aHostname, + in long aPort, + in AString aDatabase); + + boolean hasAlias(in ACString aURI); + + void getAlias(in ACString aURI, + out AString aName, + out AString aType, + out AString aHostname, + out long aPort, + out AString aDatabase); + + void updateAlias(in ACString aURI, + in AString aName, + in AString aType, + in AString aHostname, + in long aPort, + in AString aDatabase); + + void removeAlias(in ACString aURI); + + mozISqlConnection getConnection(in ACString aURI); + + mozISqlConnection getNewConnection(in ACString aURI); + +}; diff --git a/mozilla/extensions/sql/base/resources/Makefile.in b/mozilla/extensions/sql/base/resources/Makefile.in new file mode 100644 index 00000000000..297451123fc --- /dev/null +++ b/mozilla/extensions/sql/base/resources/Makefile.in @@ -0,0 +1,6 @@ +DEPTH = ../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(topsrcdir)/config/rules.mk diff --git a/mozilla/extensions/sql/base/resources/content/aliasDialog.js b/mozilla/extensions/sql/base/resources/content/aliasDialog.js new file mode 100644 index 00000000000..95e2a612815 --- /dev/null +++ b/mozilla/extensions/sql/base/resources/content/aliasDialog.js @@ -0,0 +1,39 @@ +var sqlService = null; + +var name; +var type; +var hostname; +var port; +var database; + +function init() { + sqlService = Components.classes["@mozilla.org/sql/service;1"] + .getService(Components.interfaces.mozISqlService); + + name = document.getElementById("name"); + type = document.getElementById("type"); + hostname = document.getElementById("hostname"); + port = document.getElementById("port"); + database = document.getElementById("database"); + + if (window.arguments) { + // get original values + var uri = window.arguments[0]; + sqlService.getAlias(uri, name, type, hostname, port, database); + } +} + +function onAccept() { + if (window.arguments) { + // update an existing alias + var uri = window.arguments[0]; + sqlService.updateAlias(uri, name.value, type.value, hostname.value, + port.value, database.value); + } + else { + // add a new database + var uri = "urn:aliases:" + name.value; + sqlService.addAlias(uri, name.value, type.value, hostname.value, + port.value, database.value); + } +} diff --git a/mozilla/extensions/sql/base/resources/content/aliasDialog.xul b/mozilla/extensions/sql/base/resources/content/aliasDialog.xul new file mode 100644 index 00000000000..b58bbaa69e2 --- /dev/null +++ b/mozilla/extensions/sql/base/resources/content/aliasDialog.xul @@ -0,0 +1,46 @@ + + + + + + + + +