API Documentação da API
Inscrições abertas para nosso Webinar anual Adianti Framework 2024!
Clique aqui para saber mais
Pacote Dominando o Adianti 7
Curso + Livro + Apps exemplo
Curso completo em Video Aulas (114 aulas).
Livro completo em PDF (463 páginas).
Códigos-fontes de Apps de exemplo.
API
API do Framework
Documentation

Documentation

TDatabase
in package

Database Task manager

Tags
version
7.6
author

Pablo Dall'Oglio

copyright

Copyright (c) 2018 Adianti Solutions Ltd. (http://www.adianti.com.br)

license

https://adiantiframework.com.br/license

Table of Contents

Methods

addColumn()  : mixed
Add column
clearData()  : mixed
Clear table data
copyData()  : mixed
Copy data from table to table
copyQuery()  : mixed
Copy data from query to table
countData()  : mixed
Count data from table
createTable()  : mixed
Create table
dropColumn()  : mixed
Drop column
dropTable()  : mixed
Drop table
execute()  : mixed
Execute SQL
exportToFile()  : mixed
Export data to CSV file
getData()  : mixed
Get RAW Data
getRowData()  : mixed
Get a row from the table
importFromFile()  : mixed
Import data from CSV file
insertData()  : mixed
Insert data
updateData()  : mixed
Update data
transform()  : mixed
Transform value according to mapping rules

Methods

addColumn()

Add column

public static addColumn( $conn,  $table,  $column,  $type,  $options) : mixed
Parameters
$conn :

Connection

$table :

Table name

$column :

Column name

$type :

Column type

$options :

Column options

clearData()

Clear table data

public static clearData( $conn,  $table[,  $criteria = null ]) : mixed
Parameters
$conn :

Connection

$table :

Table name

$criteria : = null

Filter criteria

copyData()

Copy data from table to table

public static copyData( $source_conn,  $target_conn,  $source_table,  $target_table,  $mapping[,  $criteria = null ][,  $bulk_inserts = 1 ][,  $auto_commit = false ]) : mixed
Parameters
$source_conn :

PDO source connection

$target_conn :

PDO target connection

$source_table :

Source table

$target_table :

Target table

$mapping :

Mapping between fields

$criteria : = null

Filter criteria

$bulk_inserts : = 1

Inserts per time

$auto_commit : = false

Auto commit after x inserts

copyQuery()

Copy data from query to table

public static copyQuery( $source_conn,  $target_conn,  $query,  $target_table,  $mapping[,  $prepared_values = null ][,  $bulk_inserts = 1 ][,  $auto_commit = false ]) : mixed
Parameters
$source_conn :

PDO source connection

$target_conn :

PDO target connection

$query :

SQL Query

$target_table :

Target table

$mapping :

Mapping between fields

$prepared_values : = null

Parameters for SQL Query

$bulk_inserts : = 1

Inserts per time

$auto_commit : = false

Auto commit after x inserts

countData()

Count data from table

public static countData( $conn,  $table[,  $criteria = null ]) : mixed
Parameters
$conn :

PDO source connection

$table :

Source table

$criteria : = null

Filter criteria

createTable()

Create table

public static createTable( $conn,  $table,  $columns) : mixed
Parameters
$conn :

Connection

$table :

Table name

$columns :

Array of columns

dropColumn()

Drop column

public static dropColumn( $conn,  $table,  $column) : mixed
Parameters
$conn :

Connection

$table :

Table name

$column :

Column name

dropTable()

Drop table

public static dropTable( $conn,  $table[,  $ifexists = false ]) : mixed
Parameters
$conn :

Connection

$table :

Table name

$ifexists : = false

Drop only if exists

execute()

Execute SQL

public static execute( $conn,  $query) : mixed
Parameters
$conn :

Connection

$query :

SQL

exportToFile()

Export data to CSV file

public static exportToFile( $source_conn,  $source_table,  $filename,  $mapping[,  $criteria = null ][,  $separator = ',' ]) : mixed
Parameters
$source_conn :

Source connection

$source_table :

Target table

$filename :

CSV File to import

$mapping :

Mapping between fields

$criteria : = null

Select criteria

$separator : = ','

Columns separator [,]

getData()

Get RAW Data

public static getData( $conn,  $query[,  $mapping = null ][,  $prepared_values = null ][, Closure $action = null ]) : mixed
Parameters
$conn :

Connection

$query :

SQL

$mapping : = null

Mapping between fields

$prepared_values : = null

Parameters for SQL Query

$action : Closure = null

getRowData()

Get a row from the table

public static getRowData( $conn,  $table[,  $criteria = null ]) : mixed
Parameters
$conn :

PDO source connection

$table :

Source table

$criteria : = null

Filter criteria

importFromFile()

Import data from CSV file

public static importFromFile( $filename,  $target_conn,  $target_table,  $mapping[,  $separator = ',' ][, mixed $bulk_inserts = 1 ]) : mixed
Parameters
$filename :

CSV File to import

$target_conn :

Target connection

$target_table :

Target table

$mapping :

Mapping between fields

$separator : = ','

Columns separator [,]

$bulk_inserts : mixed = 1

insertData()

Insert data

public static insertData( $conn,  $table,  $values[,  $avoid_criteria = null ]) : mixed
Parameters
$conn :

Connection

$table :

Table name

$values :

Array of values

$avoid_criteria : = null

Criteria to avoid insertion

updateData()

Update data

public static updateData( $conn,  $table,  $values[, mixed $criteria = null ]) : mixed
Parameters
$conn :

Connection

$table :

Table name

$values :

Array of values

$criteria : mixed = null

transform()

Transform value according to mapping rules

private static transform( $row,  $map) : mixed
Parameters
$row :

Row values

$map :

Array with mapping instruction


        
On this page

Search results