SqlQueryService TypeScript Class Reference


SERVICE This class is a "service" and it is automatically injected if declared as a member in the constructor of the consuming class. - See the constructor section below for details - See the Automatic Instance Injection page for details on the topic

The SqlQueryService class provides methods to execute raw sql queries against the local (on-device) database.

No properties

Avoid using SqlQueryService directly as it uses raw (low-level) sql query and does not return business entities. Use DbQuery class for more cases. See also BusinessObjectBase class

▶️ execute(sql: string): Promise<Array<any>>

execute method performs query execution of the sql statement provided as argument against the local on-device database and returns array of flat typescript objects.

How to use

import { View, SqlQueryService } from '@dms';
import { Customer } from '@dms-bo';

// it is supposed that there is defined business object Customer in the Business Object folder

export class MyView {

  constructor(private SqlQueryService: SqlQueryService){


  async load(){      
    var records = await this.SqlQueryService.execute(`select * from ${Customer.boTableName}`);
        console.log(`Customer name is ${record.name}`);


Last updated

Dynamics Mobile provided by Mobile Affairs Ltd. | 1712 Sofia, Bulgaria, Alexander Malinov 51 | sales@dynamicsmobile.com