Do you think writing embedded SQL code for RPG is more complex and time-consuming than it should be? You're not alone!
Have you ever started down the path to creating an SQLRPGLE program only to turn back and do it the old-fashioned way? If you said yes, I'll bet it's because RPG CHAIN, SETLL, READE, etc. are easier and less hassle than trying to unscramble the proper use of statements, prepared statements, host variables, return codes, and all the rest.
SQL(snap) eliminates the tediousness of embedded SQL and turns hours of head-banging into a few clicks. And it works with Java and PHP too!
Using embedded SQL within RPG is still optional; however, it's required if you're going to work in Java or PHP. With that in mind, let's review our options for building embedded SQL programs regardless of language:
Build it by hand with the hit-and-miss approach that accompanies all tedious programming exercises:
- Create a statement or prepared statement object.
- Declare a cursor for the statement object (to iterate the result set).
- Open the cursor (and pass parameters in the case of a prepared statement).
- Fetch rows. Iterate through the result set and execute your business steps.
- Close the cursor.
- Repeat as needed.
Use SQL(snap) to build embedded SQL for your RPG, Java, and PHP programs with just a few clicks.
1. Tell SQL(snap) about the query you want to build code for: Point and click through a complex join (for example) in a few seconds and run the query.
2. Review the resulting data and, if the query meets your needs, click to generate code and drop the resulting source onto your System i. Done!
Option 1 is from a mile-high perspective, but even from that vantage point, there are an awful lot of details to tend to.
As we consider option 2, take a look at a few screenshots of SQL(snap):
Figure 1: Build intricate SQL queries with just a few mouse-clicks!
Figure 2: Generate code with a couple more mouse-clicks!
Figure 3: Drop the code onto your System i.
So, in less than a minute, you have created an intricate query and built SQLRPGLE code to process it. SQL(snap) will do the same thing for Java and PHP.
SQL(snap) has created a fully functional program that you can compile and run based on the above query. SQL(snap) automatically generated these code components:
- Created a data structure to receive each row of the result set
- Turned the above SQL statement into an embedded SQL prepared statement
- Created a cursor object to iterate through the result set
- Opened the cursor with the appropriate variable parameters
- Created the looping logic to process the result set
- Closed the cursor
Now, you can either place the generated code into your own programs or build your own business logic around the fully functional program that SQL(snap) just built for you.
RPG, Java, and PHP each provide powerful SQL implementations. Each offers tremendous flexibility and granularity for building embedded SQL code. Unfortunately, with greater flexibility comes greater complexity, which translates into time spent--lots of time. SQL(snap) gives you back that time and makes your code more efficient and bug-free at the same time.
Other Important Features of SQL(snap)
SQL(snap) lets you surf every database in your enterprise: DB2/400, DB2, Oracle, Microsoft SQL Server, MySQL, Postgre, and others. Then, as you've just seen, with a few mouse-clicks, you can build intricate SQL queries. With a few more clicks, you can generate reliable, reusable SQL code to be used in your own RPG, Java, and PHP programs.
•· Helps you create intricate SQL queries with a few clicks via SQL Assist
•· Logs every user action and maintains its own internal audit log
•· Provides SQL access to every database in your enterprise
•· Easily exports data to CSV for use with Excel and other tools
For a limited time, we are bundling SQL(snap) with Database Everywhere, which provides RPG and CL programs with real-time access to all your external enterprise databases. SQL(snap) builds the RPG and CL code that you will use with Database Everywhere.
For a free 30-day trial of SQL(snap), a video demonstration, or our whitepaper, visit http://www.pinchhittersolutions.com/. For more information about Pinch Hitter Solutions, SQL(snap), or Database Everywhere, visit our Web site or call 800.653.7404.