DocumentaciónSQLITE_IMPORTAR(db, nombre_tabla, tabla)

SQLITE_IMPORTAR(db,nombretabla,tabla)\texttt{SQLITE\_IMPORTAR}(db, nombre_{tabla}, tabla)

Nombre

SQLITE_IMPORTAR - Recrea una tabla SQLite a partir de una tabla BLOX.

Sinopsis

ok = SQLITE_IMPORTAR(db, nombre_tabla, tabla)

Descripcion

Recrea una tabla SQLite usando como fuente una TABLA BLOX.

En esta version soporta campos escalares NUMERICO, LOGICO, STRING y VACIO; los campos faltantes se guardan como NULL. Es la funcion interna base sobre la que se construye sqlite.importar().

Comportamiento

  • Recibe un handle SQLITE, el nombre de la tabla destino y la TABLA fuente.
  • Reconstruye la estructura relacional e inserta los registros.
  • Retorna LOGICO indicando si la importacion fue exitosa.

Funciones API relacionadas

  • SQLITE_ABRIR()
  • SQLITE_EJECUTAR()
  • SQLITE_CONSULTAR()

Parámetros

ParámetroTipoDescripción
dbSQLITEHandle interno de conexion SQLite.
nombre_tablaSTRINGNombre de la tabla SQLite destino.
tablaTABLATABLA BLOX fuente a persistir en SQLite.

Valor de retorno

LOGICO - VERDADERO si la importacion se completo correctamente.

Ejemplo

ejemplo.blox
INCLUIR "sqlite.api"
INCLUIR "tablas.api"

FUNCION PRINCIPAL
INICIO

    SQLITE db
    TABLA  t, out

    t = {id = 1, nombre = "Ana", saldo = 10.5}
    t = {id = 2, nombre = "Luis", saldo = 7.0, nota = "ok"}

    db = sqlite.abrir("sqlite_importar.db")

        sqlite.importar(db, "personas", t)

        out = sqlite.exportar(db, "SELECT id, nombre, saldo, nota FROM personas ORDER BY id;")

        DEPURAR(out)
        tablas.imprimir(out)

    sqlite.cerrar(db)

FINAL