statement

Are compund statements (blocks) surrounded by parens expressions in ANSI C?

Browsing the Linux kernel sources I found some piece of code where a block of statements surrounded by parenthesis is treated as a expression a la lisp (or ML), that is, an expression which value is the value of the last statement. For example: int a = ({ int i; int t = 1; for (i = 2; i<5; i++) { t*=i; } t; ...

while loop to update dates in DB only updates first row?

I have no idea why this won't work. function query($sql) { $this->result = @mysql_query($sql, $this->conn); return($this->result != false); } function convert() { $this->db->open(); $sql_update = ""; $this->db->query("SELECT * FROM ACCOUNTS "); $str = ''; while ($row = $this->db->fetchassoc()...

prepared Statement in ejb3

Hi, i want to use prepared statement with ejb3 to insert data in oracle. is it possible to use. i try to find some example on net but i could not find any good example. Please help me to use it. or is there any other way to use parameter query (as we use ? in prepared statement) in ejb3 Thanks and regards ...

JDBC Query excecution

I am facing an issue while executing queries.I use the same resultSet and statement for excecuting all the queries.Now I face an intermittent SQlException saying that connection is already closed.Now we have to either have separate resultSet for each query or have lock like structure.Can anyone tell which is better.I think introducing lo...

Getting "final" prepared statement from MySqlCommand

I have the following MySqlCommand: Dim cmd As New MySqlCommand cmd.CommandText = "REPLACE INTO `customer` VALUES( ?customerID, ?firstName, ?lastName)" With cmd.Parameters .AddWithValue("?customerID", m_CustomerID) .AddWithValue("?firstName", m_FirstName) .AddWithValue("?lastName", m_LastName) End With I have a class that handles e...

MySQL statement using OUTER JOIN vs using WHERE to set conditions...

For the statements with INNER JOIN: SELECT column(s) FROM table1 INNER JOIN table2 ON condition(s) ... INNER JOIN tableN ON condition(s); I can write an equivalent statement with this: SELECT column(s) FROM table1, table2, ..., tableN WHERE condition(s); notice how I use WHERE to set my conditions in the second statement. Question...

SQL Select Entire Row by Distinct Columns

Hello, I need an sql statement which will allow me to select an entire row from oracle database, but by distinct columns. Here is a simplified database: Project_Num Title Category 0 Project 1 Admin 0 Project 1 Development 1 Project 2 Admin 2 Pro...

whats the difference between a command and a statement

Often when reading about Tcl (e.g. http://antirez.com/articoli/tclmisunderstood.html) you read that "everything is a command". Sometimes you also hear how other languages are, like Tcl, are "command languages." To me with my background in other languages, I just view these "commands" as statements. What precisely is the difference b...

Does return inside an if() which is inside a for() - return from the if() or the for() ?

Ok, I'm unsure if my return line will end the for() loop or just the if() question? Example: for(;;) { wait(1); if(something) { tokens = strTok(something, " ") if(tokens.size < 2) return; } } I'm guessing that it'll just return from the if(something) question but I just want to be sure... ...

I need help with VBscript.

I'm working on a vbscript program and I have got and "Expected Statement" Error. I cannot find the error. I've seen some samples of this error but they didn't help me. I am new to vbscript. Here is the code. Sub SetText(tx, lw) Dim t, l, r, a t = -1 l = Len(tx) r = "" a = 0 While t < l t = t + 1 ...

Question about return statements.

import java.util.Scanner; public class GregorianYear { private int year; public GregorianYear(int a) { year = a; } public void SetYear() { System.out.println( "The year is: " ); Scanner kbd = new Scanner( System.in ); year = kbd.nextInt(); } public int getYear() { ...

What does this define statement mean?

I have this code to draw an ellipse in the screen but i dont understand what does it means the long define statement, and i only want to know how to write the same code without all that confuse define statement. #define incx() x++, dxt += d2xt, t += dxt #define incy() y--, dyt += d2yt, t += dyt void ellipse(int xc, int yc, int rx, int...

Search select statement

I am creating a page which would have different field for the user to search from. e.g. search by: Grade: -dropdownlist1- Student name: -dropdownlist2- Student ID: -dropdownlist3- Lessons: -dropdownlist4- Year: -dropdownlist5- How do I write the select statement for this? Each dropdownlist would need a select statement which woul...

JDBC Connection and Statement Classes

Since Connection and Statements are interfaces, interface methods will be abstract by default. How can we create Connection and Statement interfaces in our Java program while connecting to the database? ...

total two or more values under one ID in SQL

![alt text][1] [1]: http://C:\Documents and Settings\Administrator\My Documents\My Pictures\Ashampoo Magical Snap 2\Magical Snap - 2009.11.16 23.07 - 003.jpg In referring to the picture there are several entries where the same Student ID repeats. Where this happens I'd like to combine the money owed by totaling any multiple entries un...

prepared statement with aggregate function

how to use prepared statement with aggregate functions ? ...

Should a servlet explicitly return at the end of doGet/doPost?

Is there any difference between explicitly returning at the end of doGet or doPost-methods, and just letting the method return "by itself"? public void doGet(HttpSerlvetRequest req, HttpServletResponse resp) { <my code here> return; } public void doGet(HttpSerlvetRequest req, HttpServletResponse resp) { <my code here> } ...

failed to prepare insert statement

sqlite3 *insert_statement=nil; if (insert_statement == nil) { static char *query = "INSERT INTO iteminfo (itemname, friendid) VALUES(?,?) where itemid=?"; if (sqlite3_prepare_v2(database, query, -1, &insert_statement, NULL) != SQLITE_OK) { NSAssert1(0, @"Error: failed to prepare statement with message '%s'.", sqlite3_e...

What is the syntax for counting number of rows in PHP Prepared Statement?

Hi, In using PHP Prepared Statement, what is the syntax for counting number of rows? $stmt = $conn->stmt_init(); $query = "SELECT * FROM TableName"; if($stmt->prepare($query)){ $stmt->num_row(); //SOMETHING SIMILAR TO THIS.... } ...

SQL select statement string concatenation

Can something like this be done with a select statement: SELECT col1, concat(col2 + ' ') FROM .... GROUP BY col1 I know i can use count(col2) or sum(col2) for integers but is there a function for concatenating if the type is nvarchar or nchar? ...