📘
TimeLine E3
  • TimeLine E3 Documentation
  • Framework
    • Introduction
    • DataSet Definition
    • Window Handling Object
      • Input/Output arguments
      • Open
      • BindDataControls
      • Item Changes
      • Item Search
      • MenuItemClicked
      • Print
      • ModuleOpened (BlueArrow)
      • BlueArrowArguments
      • New Row
      • Delete Row
      • Save
      • Transactions
      • Locking [deprecated]
      • Locking (new)
      • Resizing a response window
      • ParaPanel
      • Adding DMS Tab to a Module
    • BusinessObject
    • Controls
      • BindingFormat
      • LookupGrid and SearchDef
      • ComboBox
      • RadioButton
      • Multiline Textbox
      • xTextBoxSearch
      • xFileBrowse [v16+]
      • DxDispoColumn
      • DxProgressColumn
      • DxTemplateColumn
      • Change control caption programmatically
      • TabControl
      • Navigation
      • Enable controls programmatically
      • Enable a MenuItem programmatically
      • Filter search values
      • Jumping to another module
      • Messages, Notifications, Log, Exceptions, Translation
      • LoggerSink [deprecated]
      • Log
      • OpenFile, FolderBrowsing and SaveFile
      • Execute Actions while displaying an Hourglass
      • Using Progress
      • Async methods with progress bar
      • Wizard
      • Customizing controls using xBehaviors
      • TLProperty.AllowInReadOnly [v16+]
    • DataSet Operations
    • Business-related functionality
      • Getting the next primary key
      • Hybrids
      • Enums
      • Get Current User
    • SQL
    • SQL (using named parameters)
    • Advanced SQL
    • Expression Binding
    • Server-side logic & customization [v16+]
      • Service Hoster
      • Starting / stopping hosted services
      • Changes to scheduled jobs!
      • Business Object Proxies
      • Business Object API
    • Colors in Expression Bindings [v15+]
    • Theming
      • Icons
  • TimeLine Developer (TLD)
    • Debugging in TLD
    • Targets
    • Custom Project Rework [v16+]
  • TimeLine-specific LL functions
  • Stunnel proxy
    • Pre-requisites
    • 1. Initial setup
    • 2. Generate the server/web certificates
    • 3.a. Generating client certificates using the CSR flow
    • 3.b. Generate client certificates from the server console
    • 4. Setting up the E3 client connection
    • 5. Setting up the browser certificates
  • Configuration
    • Configuring the WCF timeout
  • Troubleshooting the E3 Bridge
  • [Deprecated]
    • TimeLine WEB - deprecated in v16+
      • Prerequisites for running the WASM modules on the server
      • Prerequisites for developing WASM modules with TLD
      • Creating a small web module with TLD
      • Terminal Configuration
    • Customization Examples - deprecated in v16+
    • Codestore [deprecated]
    • Configuring the scheduled jobs timeout - deprecated in v16+
  • ASA to PostgreSQL Migration (V17)
    • PostgreSQL Setup and DB Migration
    • ASA17 vs. PostgreSQL: Tips and Differences
      • TimeLine Migration Tools
        • SQL Transpiler
        • DataSet Migration
      • ASA17 vs PostgreSQL Syntax differences
      • Alias referencing
      • In-Line SQL Statements
    • Working with PostgreSQL in TimeLine
      • DB Objects
      • SQL files for DB Update
      • Wait for Commit
      • Postgre Tools and Commands
Powered by GitBook
On this page
  • Original V16 Statement
  • V17 Conversion
  1. ASA to PostgreSQL Migration (V17)
  2. ASA17 vs. PostgreSQL: Tips and Differences

In-Line SQL Statements

Original V16 Statement

var filterOriginal = rows.Select(x => $"(container='{x["container"]}' AND docid={x["docid"]})");

var tableOriginal = await Sql.SelectTableAsync($@"SELECT hybrid 
FROM dms_link 
WHERE hybrid LIKE 'pers^%' 
AND ({filterOriginal.StrCat(" or ")})");

V17 Conversion

PostgreSQL allows comparision of touples/pairs

// using IN
var filterComposed = rows.StrCat(",", x => $"('{x["container"].ToStringNN()}', {x["docid"].ToInt()})");

var tableComposed = await Sql.SelectTableAsync($@"SELECT hybrid 
FROM dms_link 
WHERE hybrid LIKE 'pers^%' 
AND (container, docid) IN ({filterComposed})");

Simplifying to a single entry

var filter = "container = :container AND docid= :docid"; 

var table = await Sql.SelectTableAsync($@"SELECT hybrid
FROM dms_link
WHERE hybrid LIKE 'pers^%' 
AND ({filter})", new { container = "2009", docid = 1 });

Wrong!

var filter = rows.Select(x => $"(container = '{x["container"]}' AND docid ={x["docid"]})");

var table = await Sql.SelectTableAsync(@"SELECT hybrid
FROM dms_link
WHERE hybrid LIKE 'pers^%' 
AND (:filter) ", new { filter = filter.StrCat(" or ") });

Using an SQL statement as an argument within another SQL statement is incorrect and will cause errors.

PreviousAlias referencingNextWorking with PostgreSQL in TimeLine

Last updated 26 days ago