-
Notifications
You must be signed in to change notification settings - Fork 6
DBConnection
Alan Estrada edited this page Aug 26, 2019
·
7 revisions
// build.gradle
buildscript {
repositories {
flatDir { dirs '/path/to/latte/build/libs/' }
}
dependencies {
// Remember to replace this version number with your own version
classpath "oe.espresso.latte:latte:0.2.0"
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'base'
apply plugin: 'oe.espresso.latte.latte'
task createDB(type: oe.espresso.latte.CreateDatabase) {
dbName = "sports2020"
destDir = "${buildDir}"
sourceDb = "/path/to/dlc/sports2020.db"
largeFiles = true
}
task connectDB(type: oe.espresso.latte.DBConnection) {
dependsOn createDB
dbName = 'sports2020'
dbDir = "${buildDir}"
id = 'sports2020'
singleUser = true
}
task compileCode(type: oe.espresso.latte.CompileAblTask) {
dependsOn connectDB
source('src/abl')
include('**/*.p')
dbConnections << 'sports2020'
destinationDir = file("${buildDir}/compiled")
}
In your project, create a foo.p
file in the src/abl
folder.
// src/abl/foo.p
MESSAGE 'I am foo'.
This example creates a database, creates a DBConnection, and uses the created connection to compile code in src/abl.
Use the command ./gradlew compileCode
to run this example.
If successful, there should be a foo.r
in build/compiled
of your project.
Attribute | Required | Description | Default value |
---|---|---|---|
dbName | Yes, if paramFile is not set | Database physical name | None |
paramFile | Yes, if dbName is not set | Parameter file (-pf parameter). If paramFile is set and dbName is unset, paramFile is always in first position. If both paramFile and dbName are set, dbName is in first position and paramFile in second position. Don't define multiple database connections in a single paramFile, this can lead to unexpected behavior | None |
dbDir | No | Directory where database is physically located (relative to baseDir) | None |
dbPort | No | TCP port to connect to (-S parameter) | None |
protocol | No | Protocol to use (-N parameter) | None |
logicalName | No | Logical name for the database (-ld parameter) | None |
cacheFile | No | Name of the binary cache file (-cache parameter) | None |
dataService | No | Dataservice (-DataService parameter) | None |
dbType | No | Database type (Oracle, SQL Server, ...) (-dt parameter) | None |
hostName | No | Host name where the database resides (-H parameter) | None |
userName | No | Login (-U parameter) | None |
password | No | Password (-P parameter) | None |
readOnly | No | Open the database in read-only mode (-RO parameter) | False |
singleUser | No | Open the database in single-user mode (-1 parameter) | False |
Please refer to PCTConnection for more information.