Submitted by union123 on Mon, 07/28/2008 - 00:00
Forums

Have anyone tried this RPGSQL or SQLRPG?
Just heard it but know nothing about it...
Advantage? Disadvantage?
Please enlight.....

John Foldager

Mon, 07/28/2008 - 00:00

We've used it for many years and it is of great value. It performs great, it is easy to read and use and combined with IceBreak you have easy access to build on-the-fly generated SQL statements (dynamic SQL). It is even possible to use the build in SQL syntax for doing string manipulations in just a couple of lines instead of writing a long procedure to do the same in RPG. If you need to combine data from multiple files/tables it sure is a must.
 

Best regards,

John Foldager
www.izone.dk
www.icebreakforum.org

What embedded SQL is?

If you have no idea, then you should go read on the topic... I promise you.... you won't regret

When you create an ILE RPG program you can do the following:

 
<normal ILE RPG instructions goes here...>

/sql exec INSERT INTO MyTable (FieldA, FieldB, FieldC) VALUES ('ValueA', 'ValueB', 'ValueC');

<normal ILE RPG instructions continue here...>

You see? You can embed SQL syntax directly into your ILE RPG programs.

Is this great or what?

If you need more examples, go to the tutorials section in the administration interface in IceBreak (standard is port 7000) or search the net.

Best regards,

John Foldager
www.izone.dk
www.icebreakforum.org

Hi,

Remember also that you can use the IceBreak "build in" function SQL_Execute (without the Sql installed ). The function takes four parameters:

•Format. The output format to be returned:
•HTML
•XML
•JSON as JavaScript Table View
•JSON as javaScript Result set
•JSON as extJS result set (no meta)
•JSON as extJS result set (incl. meta)

SqlStmt (The Sql statement to be executed)
Maxrows (max number of rows to return in the result set)
Start (Optional: From starting row in the result set)

The following sample returns the first 1000 records to the browser formatted in HTML:

 

 
 /free

 SqlCmd  = 'Select * from product';

 Limit = 1000;

 Start = 1;

   

  SQL_Execute(

     I_HTML:  //' Return in formated HTML

     SqlCmd:  //' The SQL statement to run "Select ..."

     limit:   //' Max number of rows to return

     start    //' Starting from row number

 ); 

 

The field I_HTML is a constant holding the value needed to tell the format used for by the function. All the formats described above have a constant value defined:

I_HTML
I_XML
I_JSTV
I_JSRS
I_EXTJS
I_EXTJSMETA
I hope you can use it.

Regards,

Bent