From 1109132f09d75da9a28b649c7677bb6ce07c40c0 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:41:45 -0500 Subject: initial commit --- files/es/mozistorageconnection/index.html | 470 ++++++++++++++++++++++++++++++ 1 file changed, 470 insertions(+) create mode 100644 files/es/mozistorageconnection/index.html (limited to 'files/es/mozistorageconnection') diff --git a/files/es/mozistorageconnection/index.html b/files/es/mozistorageconnection/index.html new file mode 100644 index 0000000000..3bfa18ae40 --- /dev/null +++ b/files/es/mozistorageconnection/index.html @@ -0,0 +1,470 @@ +--- +title: mozIStorageConnection +slug: mozIStorageConnection +tags: + - Interfaces + - Storage + - Todas_las_Categorías + - páginas_a_traducir +translation_of: Mozilla/Tech/XPCOM/Reference/Interface/mozIStorageConnection +--- +

 

+

La interfaz de mozIStorageConnection representa una conexión de base de datos adjuntos a un archivo específico o de datos en memoria de almacenamiento. Es la principal interfaz para interactuar con una base de datos, incluyendo la creación de comandos preparados, la ejecución de SQL, y el examen de los errores de base de datos.
+
+ Véase el almacenamiento de una introducción

+


+

+
storage/public/mozIStorageConnection.idlScriptable
+ + +Please add a summary to this article. + + +
+  +Last changed in Gecko 1.9 (Firefox 3)
+

+

Hereda de: nsISupports

+

Método de vista

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void close();
mozIStorageStatement createStatement(in AUTF8String aSQLStatement);
void executeSimpleSQL(in AUTF8String aSQLStatement);
boolean tableExists(in AUTF8String aTableName);
boolean indexExists(in AUTF8String aIndexName);
void beginTransaction();
void beginTransactionAs(in PRInt32 transactionType);
void commitTransaction();
void rollbackTransaction();
void createTable(in string aTableName, in string aTableSchema);
void createFunction(in AUTF8String aFunctionName, in long aNumArguments, in mozIStorageFunction aFunction);
void createAggregateFunction(in AUTF8String aFunctionName, in long aNumArguments, in mozIStorageAggregateFunction aFunction);
void removeFunction(in AUTF8String aFunctionName);
mozIStorageProgressHandler setProgressHandler(in PRInt32 aGranularity, in mozIStorageProgressHandler aHandler);
mozIStorageProgressHandler removeProgressHandler();
void preload();
+

Atributos

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AtributoTipoDescripción
connectionReadybooleanIndica si la conexión está abierta o lista para usar. Esto es pérfido si la conexión no pudo abrir o si se ha cerrado.
databaseFilensIFileEl archivo de base de datos actual. NULL +
+
+
+ <object width="18" height="18" id="tts_flash" data="http://www.gstatic.com/translate/sound_player.swf" type="application/x-shockwave-flash"> <param name="movie" value="http://www.gstatic.com/translate/sound_player.swf"/> <param name="flashvars" value="sound_name=&amp;sound_name_cb=_TTSSoundFile"/> <param name="wmode" value="transparent"/> <param name="allowScriptAccess" value="always"/></object>
+ si La Conexión de la Base de Datos en sí refiere una base de la uña de Datos en la memoria.
+
+
lastInsertRowIDlong longEl identificador de fila de la última operación INSERT de SQL. 
lastErrorlongEl último código de error SQLite que se produjo.
lastErrorStringAUTF8StringLa cadena de error Inglés reportados por la librería SQLite para el funcionamiento de SQLite pasado.
schemaVersionlongLa versión del esquema de la base de datos. Esto no debe ser utilizado hasta la base de datos está listo. La versión será reportado como 0 si no se establece. desde Gecko 1.9 M8
transactionInProgressboolean +

Devuelve true si hay una transacción en curso sobre la base de datos, de lo contrario devuelve false.

+
+

Constantes

+ + + + + + + + + + + + + + + + + + + + + + + +
ConstanteValorDescripción
TRANSACTION_DEFERRED0Predeterminado. El bloqueo de la base de datos se adquiere cuando sea necesario.
TRANSACTION_IMMEDIATE1Obtener un bloqueo de lectura sobre la base de datos inmediatamente.
TRANSACTION_EXCLUSIVE2Obtener un bloqueo de escritura sobre la base de datos inmediatamente.
+

Métodos

+

close()

+

Cierra una conexión de base de datos. C + + que llaman simplemente debe establecer la variable de la base de datos como NULL. desde Gecko 1.9 M8

+

Tienes que llamar finalize() en la declaración si ha creado uno antes de intentar cerrar o usted recibirá un NS_ERROR_FILE_IS_LOCKED excepción.

+
void close();
+
+
Parámetros
+

Ninguno.

+

createStatement()

+

Crea un mozIStorageStatement para la expresión de SQL dada. La expresión puede utilizar "?" para indicar los argumentos numerados secuencialmente (?1, ?2, etc) or ":name" y "$var" para indicar el nombre argumentos.

+
 mozIStorageStatement createStatement(
+   in AUTF8String aSQLStatement
+ );
+
+
Parámetros
+
+
+ aSQLStatement
+
+ La instrucción SQL a ejecutar.
+
+
Return value
+

Devuelve una nueva mozIStorageStatement que se utilizará para ejecutar la instrucción especificada.

+

executeSimpleSQL()

+

Ejecuta una expresión SQL. De forma predeterminada, que no espera ningún argumento en absoluto.

+
 void executeSimpleSQL(
+   in AUTF8String aSQLStatement
+ );
+
+
Parámetros
+
+
+ aSQLStatement
+
+ La instrucción SQL a ejecutar.
+
+

tableExists()

+

Este método reporta si los informes de la tabla dada existe o no.

+
 boolean tableExists(
+   in AUTF8String aTableName
+ );
+
+
Parámetros
+
+
+ aTableName
+
+ La tabla de SQL cuya existencia debe estar marcada.
+
+
Return value
+

Devuelve true si la tabla existe, false en caso contrario.

+

indexExists()

+

Este método determina si el índice dado existe.

+
 boolean indexExists(
+   in AUTF8String aIndexName
+ );
+
+
Parámetros
+
+
+ aIndexName
+
+ El índice de comprobar.
+
+
Return value
+

Returns true if the index exists, false otherwise.

+

beginTransaction()

+

Inicia una nueva transacción. De forma predeterminada, SQLite aplaza transacciones. Si la transacción ya está activa, este método produce una excepción.

+

Nota: Use of beginTransaction() and related methods is strongly recommended because it stores the transaction state in the connection. Otherwise, the attribute transactionInProgress will have the wrong value.

+
 void beginTransaction();
+
+

beginTransactionAs()

+

This method starts a new transaction of the given transaction type.

+
 void beginTransactionAs(
+   in PRInt32 transactionType
+ );
+
+
Parameters
+
+
+ transactionType
+
+ The type of transaction (TRANSACTION_DEFERRED, TRANSACTION_IMMEDIATE or TRANSACTION_EXCLUSIVE).
+
+

commitTransaction()

+

This method commits the current transaction.

+
 void commitTransaction();
+
+
Parameters
+

None.

+
Exceptions thrown
+
+
+ NS_ERROR_STORAGE_NO_TRANSACTION
+
+ No transaction is active.
+
+

rollbackTransaction()

+

This method rolls back the current transaction. This is essentially an "undo," and returns the database to the state it was in before the transaction began.

+
 void rollbackTransaction();
+
+
Parameters
+

None.

+
Exceptions thrown
+
+
+ NS_ERROR_STORAGE_NO_TRANSACTION
+
+ No transaction is active.
+
+

createTable()

+

This method creates a table with the given table name and schema.

+

Nota: At some point in the near future, this method will check to be sure the schema is the same as what is specified, but that is not currently done.

+
 void createTable(
+   in string aTableName,
+   in string aTableSchema
+ );
+
+

 

+
Parameters
+
+
+ aTableName
+
+ The name of the table to create; table names may consist of the letters A-Z in either upper or lower case, the underscore, and the digits 0-9. The first character must be a letter.
+
+ aTableSchema
+
+ The table's schema. This should be specified using the same syntax the CREATE TABLE statement uses. For example: "foo INTEGER, bar STRING".
+
+
Exceptions thrown
+
+
+ NS_ERROR_FAILURE
+
+ Table already exists or the requested table couldn't be created.
+
+

createFunction()

+

Creates a new SQLite function. since Gecko 1.9 M8

+
 void createFunction(
+   in AUTF8String aFunctionName,
+   in long aNumArguments,
+   in mozIStorageFunction aFunction
+ );
+
+
Parameters
+
+
+ aFunctionName
+
+ The name of function to create, as seen in SQL.
+
+ aNumArguments
+
+ The number of arguments the function takes. Pass -1 for variable-argument functions.
+
+ aFunction
+
+ The instance of mozIStorageFunction that implements the function.
+
+

createAggregateFunction()

+

This method creates a new SQLite aggregate function. since Gecko 1.9 M8

+
 void createAggregateFunction(
+   in AUTF8String aFunctionName,
+   in long aNumArguments,
+   in mozIStorageAggregateFunction aFunction
+ );
+
+
Parameters
+
+
+ aFunctionName
+
+ The name of the aggregate function to create, as seen in SQL.
+
+ aNumArguments
+
+ The number of arguments the function takes. Pass -1 for variable-argument functions.
+
+ aFunction
+
+ The instance of mozIStorageAggregateFunction that implements the function.
+
+

removeFunction()

+

Deletes a custom SQLite function; it works with both standard and aggregate functions. since Gecko 1.9 M8

+
 void removeFunction(
+   in AUTF8String aFunctionName
+ );
+
+
Parameters
+
+
+ aFunctionName
+
+ The name of the function to remove.
+
+

setProgressHandler()

+

This method sets a progress handler. Only one handler can be registered at a time; if you need more than one, you need to chain them yourself. since Gecko 1.9 M8

+
 mozIStorageProgressHandler setProgressHandler(
+   in PRInt32 aGranularity,
+   in mozIStorageProgressHandler aHandler
+ );
+
+

 

+
Parameters
+
+
+ aGranularity
+
+ The number of SQL virtual machine steps between progress handler callbacks.
+
+ aHandler
+
+ The instance of mozIStorageProgressHandler.
+
+
Return value
+

Returns the previous registered handler.

+

removeProgressHandler()

+

Removes a progress handler. since Gecko 1.9 M8

+
 mozIStorageProgressHandler removeProgressHandler();
+
+
Parameters
+

None.

+
Return value
+

Returns the previous registered handler.

+

preload()

+

Precarga el caché de la base de datos mediante la carga de las páginas desde el principio del archivo de base de datos hasta la caché de memoria (el tamaño de las que se especifica en PRAGMA cache_size = tamaño) está lleno o la totalidad del expediente que se lee.

+
+ Advertencia: Este método ha sido eliminado en Firefox 3.
+

El caché debe estar activo en la base de datos para que esto funcione. Esto significa que debe tener una transacción abierta en la conexión, o tiene una transacción abierta en otro contexto, que comparte la misma caché de localizador. Estos datos almacenados en caché se marchará cuando se cierra la transacción.
+
+ Esta operación precarga puede acelerar las operaciones de lectura porque los datos se carga un gran bloque.Normalmente, las páginas se lee en la carta, que puede causar muchos de disco busca.

+
 void preload();
+
+
Parameters
+

None.

+

Ejemplo: Creación de una declaración sin parámetros

+

C++

+
rv = mDBConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING("CREATE TABLE foo (a INTEGER)"));
+
+

JavaScript

+
mDBConn.executeSimpleSQL("CREATE TABLE foo (a INTEGER)");
+
+

Ejemplo: Creación de una declaración que tiene parámetros

+

C++

+
nsCOMPtr<mozIStorageStatement> statement;
+rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING("SELECT * FROM foo WHERE a = ?1"),
+                              getter_AddRefs(statement));
+NS_ENSURE_SUCCESS(rv, rv);
+
+

JavaScript

+
var statement = mDBConn.createStatement("SELECT * FROM foo WHERE a = ?1");
+
+

Ver también

+ +

-- cgit v1.2.3-54-g00ecf