---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [clients](../index.md) / CipClient

# Class: CipClient

Defined in: [packages/b2c-tooling-sdk/src/clients/cip.ts:191](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/clients/cip.ts#L191)

CIP Avatica client with protobuf transport.

Use this client for raw SQL execution against B2C Commerce Intelligence
(CIP/CCAC) data.

See [createCipClient](../functions/createCipClient.md) for the recommended construction helper.

## Example

```ts
import {OAuthStrategy} from '@salesforce/b2c-tooling-sdk/auth';
import {createCipClient} from '@salesforce/b2c-tooling-sdk/clients';

const auth = new OAuthStrategy({
  clientId: process.env.SFCC_CLIENT_ID!,
  clientSecret: process.env.SFCC_CLIENT_SECRET!,
});

const cip = createCipClient({instance: 'zzxy_prd'}, auth);

const result = await cip.query(
  'SELECT submit_date, num_orders FROM ccdw_aggr_sales_summary LIMIT 10',
  {fetchSize: 500},
);

console.log(result.rowCount, result.columns, result.rows[0]);
```

## Constructors

### Constructor

> **new CipClient**(`config`, `auth`): `CipClient`

Defined in: [packages/b2c-tooling-sdk/src/clients/cip.ts:199](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/clients/cip.ts#L199)

#### Parameters

##### config

[`CipClientConfig`](../interfaces/CipClientConfig.md)

##### auth

[`AuthStrategy`](../../auth/interfaces/AuthStrategy.md)

#### Returns

`CipClient`

## Methods

### closeConnection()

> **closeConnection**(): `Promise`\<`void`\>

Defined in: [packages/b2c-tooling-sdk/src/clients/cip.ts:223](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/clients/cip.ts#L223)

Closes the current Avatica connection (no-op if not open).

#### Returns

`Promise`\<`void`\>

***

### closeStatement()

> **closeStatement**(`statementId`): `Promise`\<`void`\>

Defined in: [packages/b2c-tooling-sdk/src/clients/cip.ts:259](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/clients/cip.ts#L259)

Closes a statement.

#### Parameters

##### statementId

`number`

#### Returns

`Promise`\<`void`\>

***

### createStatement()

> **createStatement**(): `Promise`\<`number`\>

Defined in: [packages/b2c-tooling-sdk/src/clients/cip.ts:242](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/clients/cip.ts#L242)

Creates a statement in the currently open connection.

#### Returns

`Promise`\<`number`\>

***

### execute()

> **execute**(`statementId`, `sql`, `firstFrameMaxSize`): `Promise`\<[`CipExecuteResponse`](../interfaces/CipExecuteResponse.md)\>

Defined in: [packages/b2c-tooling-sdk/src/clients/cip.ts:275](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/clients/cip.ts#L275)

Executes SQL and returns the first decoded frame.

#### Parameters

##### statementId

`number`

##### sql

`string`

##### firstFrameMaxSize

`number` = `1000`

#### Returns

`Promise`\<[`CipExecuteResponse`](../interfaces/CipExecuteResponse.md)\>

***

### fetch()

> **fetch**(`statementId`, `offset`, `fetchMaxRowCount`): `Promise`\<[`CipFetchResponse`](../interfaces/CipFetchResponse.md)\>

Defined in: [packages/b2c-tooling-sdk/src/clients/cip.ts:315](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/clients/cip.ts#L315)

Fetches an additional frame for an existing statement.

#### Parameters

##### statementId

`number`

##### offset

`number`

##### fetchMaxRowCount

`number` = `1000`

#### Returns

`Promise`\<[`CipFetchResponse`](../interfaces/CipFetchResponse.md)\>

***

### openConnection()

> **openConnection**(`info`): `Promise`\<`void`\>

Defined in: [packages/b2c-tooling-sdk/src/clients/cip.ts:210](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/clients/cip.ts#L210)

Opens a new Avatica connection.

#### Parameters

##### info

`Record`\<`string`, `string`\> = `{}`

#### Returns

`Promise`\<`void`\>

***

### query()

> **query**(`sql`, `options`): `Promise`\<[`CipQueryResult`](../interfaces/CipQueryResult.md)\>

Defined in: [packages/b2c-tooling-sdk/src/clients/cip.ts:337](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/clients/cip.ts#L337)

Executes SQL and returns the full decoded row set.

This helper opens and closes the connection automatically.

#### Parameters

##### sql

`string`

##### options

[`CipQueryOptions`](../interfaces/CipQueryOptions.md) = `{}`

#### Returns

`Promise`\<[`CipQueryResult`](../interfaces/CipQueryResult.md)\>
