Store in a array

Hi,
I have a program with this query script:
public ResultSet StartQuery() {
        ResultSet rs = null;
        try {
            rs = stmt.executeQuery("SELECT uniqueid, " +
                    "clid, " +
                    "src, " +
                    "dst, " +
                    "billsec, " +
                    "DATE_FORMAT(calldate, '%H:%i:%s'), " +
                    "DATE_FORMAT(calldate, '%Y-%m-%d'), " +
                    "SEC_TO_TIME(billsec) " +
                    "FROM cdr " +
                    "WHERE calldate like '" + this.getTheDate + "%' " +
                    "ORDER BY calldate DESC");
            while (rs.next()) {
                    //How to save it on a array
        } catch (SQLException e) {
            e.printStackTrace();
        //this.secondQuerySQL(rs);
        return rs;
    }I have a code in php where in I can save my result on an array. Let me give you my script:
public function getQueryPIN(){
          $sql = "SELECT DISTINCT PIN FROM clients";
          //$this->conn1->debug = true;
          $rs = $this->conn1->Execute($sql);
          if ( $rs === false ) return false; // SQL error ocurred
          if ( $rs->EOF ) return false; // no rows returned
          static $count=1;
          while(!$rs->EOF) {
               //print "<font color=black>".$rs->fields['PIN']."</font> | ";
               $count++;
               $data_limit[$rs->fields['PIN']] = array(
               'PIN' => $rs->fields['PIN']);
               $rs->MoveNext();
          print $count."<br>";
          //print_r($data_limit);
          return $data_limit;
     }Can you give same process on php that can save on an array??

ResultSet rs = null;
        Map ResultSets= new HashMap();
        try {
        rs = stmt.executeQuery("SELECT uniqueid, clid, src, dst, billsec, DATE_FORMAT(calldate, '%H:%i:%s'), DATE_FORMAT(calldate, '%Y-%m-%d'), SEC_TO_TIME(billsec) FROM cdr where calldate like '" + this.getTheDate + "%' order by calldate desc");
        while (rs.next()) {
        String[] row = {rs.getString("uniqueid"),
        rs.getString("clid"),
        rs.getString("src"),
        rs.getString("dst"),
        rs.getString("billsec"),
        rs.getString(6),
        rs.getString(7),
        rs.getString(8)
        ResultSets.put(rs.getString("uniqueid"),(String[])row);
//        Use an *Iterator* to print the results
//        System.out.println(ResultSets);
        } catch (SQLException e) {
        e.printStackTrace();
        }Above is the corrcted code.
Now, to display the value by iterating through the map use the below code:
Map ResultSets = new HashMap();
        Iterator iter = ResultSets.keySet().iterator();
        String[] newRowString = new String[8];
        while(iter.hasNext()){
             newRowString = (String[])ResultSets.get((String)iter.next());
             for(int i=0;i<newRowString.length; i++){
                  System.out.println("The element from Array is::: "+newRowString);
}Edited by: AnishThomas on Mar 14, 2008 11:05 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Can't store new target Array index out of range: 1 - SLD Configuration

    Hello ,
    Issue is regarding SLD configuration , We have ABAP + Java Addin on Suse Linux x86 ( 64 bit ) with Oracle 9.x .
    Java instalaltion competed succesfully , J2EE is up and runnung while configuring SLD , Data Supplier Bridge - Configure the data supplier bridge - Update SLDs
    As I set Update local SLD (sld/active) to true it gives error : Can't store new target Array index out of range: 1
    ( Error recorded in default.trace ,
    #1.5#001635052D79005D000000010000393A00041904004A592B#1153404882278#com.sap.engine.library.monitor.mapping.ccms.Trace##com.sap.engine.library.monitor.mapping.ccms.Trace######87587b2017f911dbc661001635052d79#SAPEngine_System_Thread[impl:5]_82##0#0#Error##Plain###RegisterNode</Services/Web Services/Requests Number/sap.com/com.sap.engine.heartbeat/GRMGWSTest/CurrentClient>: com.sap.mona.api.JMonException: com.sap.mona.api.JMonAPIException: Internal error in tree structure#
    #1.5#001635052D790049000000060000393A000419040226E9F1#1153404913510#com.sap.lcr.sagent.BuilderDirector#sap.com/com.sap.lcr#com.sap.lcr.sagent.BuilderDirector#J2EE_ADMIN#317####29009b1017fa11db96bd001635052d79#SAPEngine_Application_Thread[impl:3]_14##0#0#Error#1#/Applications/SLD#Plain###Can't access http store#
    #1.5#001635052D790049000000070000393A000419040226EA90#1153404913511#com.sap.lcr.sagent.BuilderDirector#sap.com/com.sap.lcr#com.sap.lcr.sagent.BuilderDirector#J2EE_ADMIN#317####29009b1017fa11db96bd001635052d79#SAPEngine_Application_Thread[impl:3]_14##0#0#Error##Plain###Thrown:
    com.sap.lcr.api.cimclient.LcrException: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1
    I have already through updated Component Repository – SAP Note : 669669 . 
    Regards ,
    Santosh

    Hi,
    I am having exactly the same issue. Would you please advise what the solution was?
    Thanks,
    Murad.

  • Store into an array the results of a PhpService

    Hi all I have a problem with flex and I'm stuck and we need help, this is urgent !!!!!! please
    My problem is that I would like to store in an array or ArrayCollection the result of running a php function (in my case "getTestSesion ()") to make any changes on some of the elements that my array will contain, before placing it on my  DataGrid.dataProvider (when I say change I mean items such as concatenate something to a specific element)
    I leave more and less what I have done.
    This is my table in mysql:
    CREATE TABLE IF NOT EXISTS `sesion` (
      `id_ses` int(1) NOT NULL AUTO_INCREMENT,
      `nombre_sesion` varchar(18) NOT NULL,
      `detalle_sesion` varchar(32) DEFAULT NULL,
      PRIMARY KEY (`id_ses`)
    ) ENGINE=InnoDB
    and I create this function to read my table using the Flash Builder wizard for DB connection:
    public function getTestSesion() {
         $stmt = mysqli_prepare($this->connection,
              "select id_ses as id,
                 nombre_sesion as nombre
               from sesion");    
          $this->throwExceptionOnError();
          mysqli_stmt_execute($stmt);
          $this->throwExceptionOnError();
          $rows = array();
          mysqli_stmt_bind_result($stmt, $row->id, $row->nombre);
          while (mysqli_stmt_fetch($stmt)) {
              $rows[] = $row;
              $row = new stdClass();
              mysqli_stmt_bind_result($stmt, $row->id, $row->nombre);
          mysqli_stmt_free_result($stmt);
          mysqli_close($this->connection);
          return $rows;
    and on my aplication i have:
    <fx:Script>
       protected function miDatagrid_creationCompleteHandler(event:FlexEvent):void
              createSesionResult.token = pruebasService.getTestSesion();
    </fx:Script>
    <fx:Declarations>
    <s:CallResponder id="createSesionResult"/>
    </fx:Declarations>
        <mx:DataGrid x="139" y="90" id="dataGrid"
                     creationComplete="miDatagrid_creationCompleteHandler(event)"
                     dataProvider="{createSesionResult.lastResult}">
            <mx:columns>
                <mx:DataGridColumn headerText="id" dataField="id"/>
                <mx:DataGridColumn headerText="nombre" dataField="nombre"/>
            </mx:columns>
        </mx:DataGrid>

    Hello everybody
    please can somebody help me:
    this is another simple example:
    I have this function into my service class:
    public function test($my_string)
      // creating an array by explode command
      $my_array = explode(" ",$my_string);
      return $my_array; // returning the array
    and since my aplication i call this like this:
    var myarray:Array = salfventasseriesService.test("this is a test");
    but i have this error:
    Multiple markers at this line:
    -1067: Implicit coercion of a value of type mx.rpc:AsyncToken to an unrelated type Array.
    -myarray
    How can I put the resul into an ARRAY ?
    can anybody help me ?

  • Store bufferimage in array

    Hello friends.
    I want scan an image (png) and store all the pixel values in array. My image has only three colors (white,red & blue)
    basically its a graph with blue for co-ordinate
    white as background
    and the red color is the plotted area of graph.
    I am writing the folowing code
    try{
    img = ImageIO.read(new File("img/image0.png"));
    } catch (IOException e) { }
    w= img.getWidth(this);
    h=img.getHeight(this);
    int[] rgbs = new int[w*h];
    BufferedImage bimage = new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);
    for(int i =0;i<(h-1);i++)
    { for (int j = 0;j<(w-1);j++)
    {      rgbs[i] = (bimage.getRGB(i,j));
    System.out.println(rgbs);}}
    MY aim is to store either int or hex values of all the pixels in the array.
    So tht when i scan the array, i can get the location at which red color is stored in the array.
    Plz help my friends.....

    It's easier to just change the code than explain everything, but I will make some points:
    The random number function only runs once, so all the numbers inside the loop will be the same.
    The key to what you wanted is the shift register, which allows keeping the same array between different iterations.
    A for loop is only relvant if you know in advance how many times you are going to run, not if you are waiting for user input.
    If you are using a for loop and you don't need to see the array inside the loop, you can simply wire the numeric value out of the loop and it will be built into a 1D array automatically.
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here, here, here, here and here are a few you can start with and here are some tutorial videos. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
    Try to take over the world!
    Attachments:
    ArrayExample mod.vi ‏19 KB

  • How to pick up values of particular tag from XMl file & store into an array

    Hi , i m using sax parser to read below xml file.
    <dvd-list>
    <dvd>
    <id>001</id>
         <title>Bollywood</title>
         <name>Lord of the rings</name>
         <length>150</length>
         <actor>Jonathan Austin</actor>
         <actor>Nicole Kidman</actor>
    </dvd>
    <dvd>
    <id>002</id>
         <title>Hollywood</title>
         <name>Taare Zamin pe</name>
         <length>200</length>
         <actor>Amir Khan</actor>
         <actor>Darsheel</actor>
    </dvd>
    <dvd>
    <id>003</id>
         <title>Bollywood</title>
         <name>Matrix reloaded</name>
         <length>150</length>
         <actor>Mickel</actor>
         <actor>Hally Berry</actor>
    </dvd>
    </dvd-list>
    & i want to store it into an arraylist .
    I declared arraylist a class var .
    i want to store all ids into an arraylist ...
    below is my code public void endElement (String namespaceURI, String localName, String qName, Attributes atts)
        throws SAXException
             if(qName.equals("id"))
       for (int i = 0; i < atts.getLength (); i++) {
                    list.add(i,atts.getValue (i));
           // showData ("</"+qName+">");
        }not working ... plz help me in this regard
    thanks a lot

    thanks , my id tag has no attribute...
    but sir again i m facing 1 problem
    to pick up values of tag i wrote below code public void startElement (String namespaceURI, String localName, String qName, Attributes atts)
        throws SAXException
             System.out.println("localName"+qName);
             str=qName;
        public void characters (char buf [], int offset, int len)
        throws SAXException
             String s = new String(buf, offset, len);
          System.out.println("char>>"+s);
          s.trim();
          if(str.equals("id"))
               list.add(s);
              if(str.equals("name"))
                   list.add(s);
              if(str.equals("title"))
                   list.add(s);
              if(str.equals("length"))
                   list.add(s);
              if(str.equals("actor"))
                   list.add(s);   
        public void endElement (String namespaceURI, String localName, String qName, Attributes atts)
        throws SAXException
        }here my list size shud be 5 ideally but it is showing 30!!!!
    also debug stmt sysout(char>>+s); is showing series of
    char>> ...it means charactes(0 method is being called several times ...while my xml contains
    <dvd-list>
    <dvd>
    <id>001</id>
         <title>Bollywood</title>
         <name>Lord of the rings</name>
         <length>150</length>
         <actor>Jonathan Austin</actor>
    </dvd>
    </dvd-list>
    plz help me in this regard to understand this flow....
    thanks a lot in advance

  • Need help with how to store data in array in from reading file

    i have a file named xxx.txt
    i need to retreive data from that file. the data that i want to retrieve is enclosed with << >>
    temp xxx-123 ccc << 90.5>>
    haha xxx-563 sss 85.2
    after a few lines, the another record appear.
    temp2 xxx-123 ccc << 190.5>>
    haha2 xxx-563 sss 885.2
    i would like to record down the data, 90.5 & 190.5, how do i go about doing so, will appreciated it if someone would guide me along. thanks

    After you have read a line from the file either
    find the location of << and >> and substring the stuff in between or
    use regex (regular expression) however this is advanced and may be beyond your level of understanding.

  • Re: How to store the Information in arrays or Map?

    Hello Everyone,
    I'm reading a calling information from a file
    Calling number, Called to, Time Started, Time Ended
    050, 060 , 1255, 1350
    050, 080, 1050, 1100
    050, 060, 1110, 1130
    080, 090, 0530, 0610
    What is the best way to read this information and store it in arrays so that if I want to find out 050 called what numbers and at what times ?? How can I do that ?

    Create a class called Call or CallData or something that has fields for those quantities. Store instances of that class in a Map where the key is the calling number and the value is the object.
    http://java.sun.com/docs/books/tutorial/collections/

  • How can i store values from my String into Array

    Hi guys
    i wants to store all the values from my string into an array,,,, after converting them into intergers,,,, how i can do this becs i have a peice of code which just give me a value of a character at time,,,,charat(2)...BUT i want to the values from String to store in an Array
    here is my peice of code which i m using for 1 char at time
    int[] ExampleArray2 = new int[24];
    String tempci = "Battle of Midway";
    for(int i=0;i>=tempci.length();i++)
    int ascii = tempci.charAt(i); //Get ascii value for the first character.

    public class d1
         public static final void main( String args[] )
              int[] ExampleArray2 = new int[24];
              String tempci = "Battle of Midway";
              for(int i=0;i<tempci.length();i++)
                   int ascii = tempci.charAt(i);
                   ExampleArray2=ascii;
              for(int i=0;i<ExampleArray2.length;i++)
                   System.out.println(ExampleArray2[i]);

  • How to store Array of Strings in MS-Access

    Dear all,
    i am facing a problame from the couple of days can any one plzzzzzzz guide what should i do to over come my problame....>
    I want to store a String array in Microsoft Access database but i couldn't find the way how can i do so
    public class ArrayJDBC {
    /** Creates a new instance of ArrayJDBC */
    public ArrayJDBC() {
    public static void main(String[] args){
    System.out.println("main started");
    new ArrayJDBC().enterArray();
    System.out.println("main after data entry");
    public void enterArray(){
    Connection con = null;
    PreparedStatement pstm = null;
    String dataSource = "checkArray";
    String query = "INSERT INTO array(Object) VALUES(?)";
    String[] strArray = {"one","two","three"};
    con = new JDBCConnection().makeConnection(dataSource);
    try{
    pstm = con.prepareStatement(query);
    System.out.println("pstmt created");
    pstm.setObject(1,strArray);
    System.out.println("array seted as object");
    int r = pstm.executeUpdate();
    System.out.println("data updated "+r);
    pstm.close();
    con.close();
    }catch(SQLException se){
    System.out.println("Data could not be update "+se);
    this is my class the conncection is already established.
    i use updateObject() method but it doesnt work..
    plz guide me that how can i store
    strArray in Microsoft Access and also tell me that what should be the data type in my database i.e ms-access

    Well easiest way to do that is to create a single String where the values from array will be separated by some separator for example semicolon so you will get "one;two;three" this string you will store in database as a text, then when you read it back you need to parse it again to get an array of Strings. I am originally C# programmer there i would do serialization to XML and store it into database try looking here http://iharder.sourceforge.net/current/java/xmlizable/ they are creating XML Serializer.
    Peter.

  • Store boolean array as text file

    Hi there
    I'm having some trouble storinge a 25x25 2D array of booleans in a text file.
    First I make the 2D array a 1D array, and then I change it to a number, but here something already goes wrong, not the full number is stored, presumably because the array is this big?
    Any help will be much appreciated!
    Solved!
    Go to Solution.
    Attachments:
    Store 2D boolean array LV10.vi ‏17 KB

    You can also convert the 2D boolean array into 1D array of numbers and save to text file and then read back to load the original 2D Boolean array
    The best solution is the one you find it by yourself
    Attachments:
    2D Boolean to String.vi ‏16 KB

  • Random No. store in Array

    Hi Guys,
    I want random no between 1 to 15 store in my array.
    but that time not repeat the any no.
    for e.g myArray(4,6,8,9,2,3,5,1,7,10,13,15,12,11)
    can you check my code.
    var randomNo:Number;
    var holdArray:Array = new Array();
    for (var i:Number = 0; i < 15; i++)
    randomNo = Math.round(Math.random() * (15 - 1)) + 1;
    holdArray.push(randomNo);
    Thanks,
    JaxNa

    Your code will repeat values randomly.  Try the following instead...
    var holdArray:Array = new Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
    function shuffle(a) {
        var p;
        var t;
        var ivar;
        for (ivar = a.length-1; ivar>=0; ivar--) {
            p=Math.floor((ivar+1)*Math.random());
            t = a[ivar];
            a[ivar] = a[p];
            a[p] = t;
    shuffle(holdArray);
    trace(holdArray);

  • How to store (non-persistent) multiple float[] arrays.

    Hi;
    In a situation where an object needs to store multiple float arrays, how can I use a 2 dimensional array to store them? I can't use a collection since an array is a primitive.
    I would use a 2 dimensional array, but my keys to get/set these arrays are ints. So I cant do a "int i[][]", nor a "float f[][]".
    Any ideas?
    Thanks;
    -nat

    You could make a Map (such as HashMap) with an
    Integer (java.lang.Integer) key and a "int []" or "float []" as a value (an array is an Object, so can be put as a value).You kid me not! I need to review my basics.
    I simply didn't know that an array of primitives can be stored as a value in a map.
    Thank you!
    -nat

  • SUPStorage api in SUP 2.1 to store array or structure

    Hi,
    I am using below code to store key value pair using SUP api for offline storage in workflow apps:
    SUPStorage.prototype.setItem(j, airlineId);
    Example: var j = 1;
                  var airlineid = "lufthansa";
      This works fine, but I want to store an array or at least a structure (single row) which has multiple items. How can we do that?
    I tried passing MBO value data directly, but it gives exception while I try to read:
    var mvc = getCurrentMessageValueCollection();
          var fData = mvc.getData("flightmbo");
          var values = fData.getValue();
         var i = 1;
         SUPStorage.prototype.setItem(i, values);
       This does not give any exception, but when I try to read by using code:
    var  i = 1;
        airlineKey =  SUPStorage.prototype.key(i);
        values =  SUPStorage.prototype.getItem(airlineKey);
    var j = 0;
       var theItems = values[j];
    This gives exception saying "Type Error: Result of expression 'values' [null] is not an object".
    Any workarounds to store a structure/array with the same key (such as airline id, text, time, availability).
    Thanks,
    Rohit

    Have you tried converting the array/structure to a string using JSON (or some similar technique) and storing it that way?

  • How to store 2C array to a singl binary file

    Hi
    I have to store multiple waveforms output that is each 1D array to a single binary file. how do i do this.
    i can store 1D array to binary file and retrieve it by reading the binary file and plotting the waveform. but i am not able to store 2D array to the single file. how do store many 1D array in one binary file,
    Thank you. Hema

    (We would also need to know your LabVIEW version. If you have a very old version, things would be quite different.)
    As Smercurio_fc already mentioned, the option to "prepend array size" would make things much easier here, because then you would read it as a single 2D array.
    Here's how that would look like. This is probably the recommended solution, just for simplicity reasons.
    Not prepending the size is more useful if you write the data in increments, but later want to read it as one.
    Message Edited by altenbach on 11-15-2008 09:02 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    SaveRestore2D.png ‏21 KB

  • Gui connect to a store array

    Hi, beasicaly i have a gui created in awt and I want the details entered into the gui to be saved in my store array but I don't know how to do this, so help would be great :) ...i think its along the lines of :
    store[n] = name.getText();
    Not sure though ?
    Thanks

    No.
    The variable "store" is of the type "Store", i.e. a single Store, not an array. You need to declare the variable to be of the type "Store[]". It would make more sense to name it "stores" in that case, of course.
    Obviously, your variable "n" needs to contain an integer value that is within the bounds of the array, not a Student. Your code really makes no sense at all. Perhaps this tutorial will help (there are other tutorials there as well).

Maybe you are looking for

  • View source doesn't work / is broken / not working in 6.1.0.1

    View source in IE6 works on the guest users mypage when they first land on the site and on the login page, but any other community page once you login - it breaks. I'm having to use the 'view partial source' in my right click context menu as offered

  • Runtime Error An exception occured while processing the request

    Hi gurus i have a problem with this #1.5 #001CC4944DC600750000097A0000205800046235A0C4AEEE#1233882376782#com.sap.portal.prt.runtime#sap.com/irj#com.sap.portal.prt.runtime#jsbautista#86842##n/a##586788e0f3ea11ddbc08001cc4944dc6#SAPEngine_Application_T

  • Y50 display questions

    I have a few questions about the display on the lenovo y50 touch.What are the specifications of the display? (like brightness, etc)The touch model is heavier than the non touch one, is it because it has a touch screen? I saw the instructions on how t

  • Choosing a midi keyboard for garage band

    Hi All, I am buying my daughter a keyboard and would like to ensure that when she gets her new Mac taht it will work. I am looking at the Yamaha YPT200 or the Casio CTK-800 If anyone has some experience with these and can offer feedback that would be

  • Trouble inputting to an Array...

    I have the following setup: CLASS STORAGEBUSINESS private ArrayList<Customer> storageCustomer; // setters & getters public void setCustomers() {   if (storageCustomer == null)      storageCustomer = new ArrayList<Customer>(); public ArrayList getCust