resultset Questions

7

Solved

I have this code: $rows = array(); $res = mysql_query($someQuery); if(!mysql_errno()) while($row = mysql_fetch_assoc($res)) $rows[] = $row; $someQuery is an arbitrary query that I write in to...
Benzoate asked 23/4, 2009 at 19:9

3

Solved

I'm using CodeIgniter's active record class and the query looks something like this: $query = $this->db ->get_where('Table', array('field' => $value)); What's the fastest way to get a fi...
Schulze asked 6/12, 2010 at 23:19

2

Solved

I'm thinking about efficiency, and I'm not really sure about it one way or another. But I have a bunch of rows with multiple columns. I just need the name field from all the rows where a certain ot...
Gand asked 8/8, 2012 at 22:34

8

Solved

As the ResultSet contains the data returned from the dynamic SQL, if there are any method to determine if the ResultSet contains a particular column name? For example , if I run rs.getString("...
Hives asked 30/8, 2010 at 11:21

16

Solved

Shouldn't this be a pretty straightforward operation? However, I see there's neither a size() nor length() method.
Unicellular asked 10/10, 2008 at 16:12

5

In Java, I have a query like this: String querystring1= "SELECT rlink_id, COUNT(*)" + "FROM dbo.Locate " + "GROUP BY rlink_id "; The table rlink_id has this data: Sid lid 3 2 4 4 7 3 9 1 ...
Radiograph asked 4/10, 2011 at 5:18

3

Solved

I have the following: $counter = 1; while ($row = mysql_fetch_assoc($result)) { $counter2 = $counter++; echo $counter2 . $row['foo']; } Is there an easier way to get 1,2,3 etc for each result o...
Shopper asked 22/5, 2011 at 10:35

3

Solved

How can I iterate ResultSet ? I've tried with the following code, but i get the error java.sql.SQLException: Illegal operation on empty result set. while ( !rs.isLast()) { rs.next(); int id = r...
Zhukov asked 30/3, 2010 at 13:29

13

We are currently building a Map manually based on the two fields that are returned by a named JPA query because JPA 2.1 only provides a getResultList() method: @NamedQuery{name="myQuery",query="se...
Callas asked 6/12, 2010 at 22:0

15

Solved

The following code converts a ResultSet to a JSON string using JSONArray and JSONObject. import org.json.JSONArray; import org.json.JSONObject; import org.json.JSONException; import java.sql.SQLE...
Mortification asked 29/6, 2011 at 1:32

9

Solved

I'm using a ResultSet in Java, and am not sure how to properly close it. I'm considering using the ResultSet to construct a HashMap and then closing the ResultSet after that. Is this HashMap techni...
Rociorock asked 21/9, 2011 at 21:50

3

I am trying to get a list of users, who submitted a specific event in a website, however when I run the query, I am not getting the full result set - for example, I found 2 users who had the event ...
Bromism asked 14/3, 2018 at 14:34

11

Solved

I have a user class that has 16 attributes, things such as firstname, lastname, dob, username, password etc... These are all stored in a MySQL database and when I want to retrieve users I use a Res...
Shaitan asked 22/2, 2014 at 15:4

4

Is there any way I can get resultset object from one of jdbctemplate query methods? I have a code like List<ResultSet> rsList = template.query(finalQuery, new RowMapper<ResultSet>() {...
Mead asked 15/3, 2011 at 15:36

5

Solved

I'm not entirely sure this is possible, and I definitely don't know what to search or how to concisely explain it, but this seems like quite a kotlin-y thing which I wouldn't be surprised if it was...
Furnary asked 1/6, 2017 at 19:50

3

Solved

I am trying to get the row count of a result set by: rs.last(); int row_count = rs.getRow(); but im getting an Invalid operation for forward only resultset : last error. The result set is gettin...
Upanishad asked 25/1, 2012 at 17:19

5

Solved

I have been doing CRUD operation on database, but i could not find any direct method for the getting the data type char in database. Though i achieved the output using the getString(String column_...
Intracranial asked 7/6, 2013 at 21:4

5

Solved

ResultSet#getBoolean seems to return false when it's null. Is there an easy way to get a Boolean (not boolean) from a ResultSet?
Ryeland asked 18/9, 2016 at 18:22

6

Solved

I have two columns which store DateTime values in a MySql database, When I try to get them from a ResultSet in Java there is no option: getDateTime() Should I use getDate() or wouldn't that work...
Pulsate asked 3/4, 2013 at 9:48

7

Solved

Is "ResultSet" considered to be an ArrayList? I'm talking about jdbc. If no, then how do I put the information i get from my DB using the while (result.next()) { .... } syntax into an ArrayLis...
Cheap asked 30/9, 2014 at 18:9

3

This is how I get one record with MySQLi: $result = $db->query("..."); $image = $result->fetch_object(); Now I need to get the comments and pass it to the view. I'm using the follo...
Summertime asked 6/1, 2012 at 8:43

13

Solved

In Java I'm trying to test for a null value, from a ResultSet, where the column is being cast to a primitive int type. int iVal; ResultSet rs = magicallyAppearingStmt.executeQuery(query); if (rs....
Offcenter asked 27/5, 2010 at 10:42

13

Solved

I'm developing a php app that uses a database class to query MySQL. The class is here: http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/*note there are multiple bad practices...
Camphor asked 20/6, 2011 at 15:24

16

Solved

I'm using JDBC for very simple database connectivity. I have created my connection/statement and executed a query. I check the query object of the statement in the debugger to confirm that it is s...
Moncada asked 3/12, 2010 at 6:34

9

Solved

I have a sql statement that returns no hits. For example, 'select * from TAB where 1 = 2'. I want to check how many rows are returned, cursor.execute(query_sql) rs = cursor.fetchall() Here I ...
Lorsung asked 15/5, 2013 at 9:26

© 2022 - 2024 — McMap. All rights reserved.