alamb commented on code in PR #14639:
URL: https://github.com/apache/datafusion/pull/14639#discussion_r1954334989


##########
docs/source/user-guide/sql/prepared_statements.md:
##########
@@ -0,0 +1,123 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Prepared Statements
+
+The `PREPARE` statement allows for the creation and storage of a SQL statement 
with placeholder arguments.
+
+The prepared statements can then be executed repeatedly in an efficient manner.
+
+##### SQL Example
+
+Create a prepared statement `greater_than` that selects all records where 
column "a" is greater than the parameter:
+
+```sql
+PREPARE greater_than(INT) AS SELECT * FROM example WHERE a > $1;
+```
+
+The prepared statement can then be executed with parameters as needed:
+
+```sql
+EXECUTE greater_than(20);
+```
+
+##### Datafusion Example
+
+```rust

Review Comment:
   
   In order to test that the doc examples run (and thus that they compile and 
remain working)  we need to add an entry to `core/src/lib.rs` like this:
   
   
   ```diff
   diff --git a/datafusion/core/src/lib.rs b/datafusion/core/src/lib.rs
   index 48ee8e46b..70b595442 100644
   --- a/datafusion/core/src/lib.rs
   +++ b/datafusion/core/src/lib.rs
   @@ -962,6 +962,12 @@ doc_comment::doctest!(
        user_guide_sql_operators
    );
   
   +#[cfg(doctest)]
   +doc_comment::doctest!(
   +    "../../../docs/source/user-guide/sql/prepared_statements.md",
   +    user_guide_prepared_statements
   +);
   +
    #[cfg(doctest)]
    doc_comment::doctest!(
        "../../../docs/source/user-guide/sql/scalar_functions.md",
   ```
   
   Then you can run the doc tests like this: 
   
   ```shell
   cargo test --doc -p datafusion -- prepared_statement
   ```
   
   Since I had the code checked out anyways I went ahead and pushed the code to 
test the examples (and make those tests pass)  to this PR



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to