> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/jdbc/preservesinglequotes.md).

# PreserveSingleQuotes

Prevents from automatically escaping single quotation mark characters that are contained in a variable.

It is not neccesary to use this function around listQualify() when the qualifier is a single quote, or around quotedValueList() as those automatically preserve and escape single quotes as needed when used inside a query component.

## Method Signature

```
PreserveSingleQuotes(variable=[String])
```

### Arguments

| Argument   | Type     | Required | Description                                                    | Default |
| ---------- | -------- | -------- | -------------------------------------------------------------- | ------- |
| `variable` | `String` | `true`   | The expression that needs to have its single quotes preserved. |         |

## Examples

### Preserve single quotes in a SQL string

Prevents double-escaping of single quotes in dynamic SQL.

```java
sql = "SELECT * FROM users WHERE name = '#preserveSingleQuotes( "O'Brien" )#'";
writeOutput( sql.contains( "O'Brien" ) );

```

Result: true

## Related

* [IsInTransaction](/boxlang-language/reference/built-in-functions/jdbc/isintransaction.md)
* [IsWithinTransaction](/boxlang-language/reference/built-in-functions/jdbc/iswithintransaction.md)
* [QueryExecute](/boxlang-language/reference/built-in-functions/jdbc/queryexecute.md)
* [TransactionCommit](/boxlang-language/reference/built-in-functions/jdbc/transactioncommit.md)
* [TransactionRollback](/boxlang-language/reference/built-in-functions/jdbc/transactionrollback.md)
* [TransactionSetSavepoint](/boxlang-language/reference/built-in-functions/jdbc/transactionsetsavepoint.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/jdbc/preservesinglequotes.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
