You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|[Model](/api/model/)| The Model subclass this builder is bound to |
713
713
714
-
## toString()
715
-
716
-
```js
717
-
constsql=queryBuilder.toString();
718
-
```
719
-
720
-
Returns the SQL string suitable for logging input **but not for execution**, via Knex's `toString()`. This method should not be used to create queries for database execution because it makes no guarantees about escaping bindings properly.
721
-
722
-
Note: In the current release, if the query builder attempts to execute multiple queries or throw any exception whatsoever, **no error will throw** and instead the following string is returned:
723
-
724
-
```
725
-
This query cannot be built synchronously. Consider using debug() method instead.
726
-
```
727
-
728
-
Later versions of Objection may introduce a native way to retrieve an executable SQL statement, or handle this behavior differently.
| string | The SQL this query builder will build, or `This query cannot be built synchronously. Consider using debug() method instead.` if an exception is thrown |
735
-
736
-
## toSql()
737
-
738
-
```js
739
-
constsql=queryBuilder.toSql();
740
-
```
741
-
742
-
An alias for `toString()`.
743
-
744
-
Note: The behavior of Objection's `toSql()` is different from Knex's `toSql()` (see above). This method may be deprecated soon.
| string | The SQL this query builder will build, or `This query cannot be built synchronously. Consider using debug() method instead.` if an exception is thrown |
0 commit comments