Go Back   Champions of Regnum > English > The Inn

The Inn A place to gather around and chat about almost any subject

Reply
 
Thread Tools Display Modes
Old 04-02-2009, 10:50 PM   #11
ArcticWolf
Duke
 
ArcticWolf's Avatar
 
Join Date: Nov 2006
Location: 0x00CAFE
Posts: 3,366
ArcticWolf is a glorious beacon of lightArcticWolf is a glorious beacon of lightArcticWolf is a glorious beacon of lightArcticWolf is a glorious beacon of lightArcticWolf is a glorious beacon of light
Default

Quote:
Originally Posted by Eli2
Code:
public DataResult[] executeStatement(String sqlStatement, String[]... fields) throws QueryException
Line 149

What does this "..." do ?
Well, nothing really interesting... It's just some syntactic sugar. :P

It makes an array with the arguments. You can cast the code with 2, 3 or more arguments. Some sample code:

Code:
Database database = DatabaseFactory.getDatabase(
DatabaseFactory.SQLITE3, "/tmp/test.db", null, null);
String[] data = {"xephandor", "19"};
String[] data2 = {"saskia", "19"};
String[] data3 = {"erland", "19"};
DataResult[] result = database.executeStatement("delete from users where name='?' and age=?",data, data2, data3);
This will return the error state of the query.

I know, the implementation sucks big time, but it may work.
__________________
I don't have a solution, but I admire the problem.
ArcticWolf no ha iniciado sesión   Reply With Quote
Old 04-02-2009, 11:13 PM   #12
arlick
Duke
 
arlick's Avatar
 
Join Date: Jan 2007
Posts: 3,939
arlick is a jewel in the rougharlick is a jewel in the rougharlick is a jewel in the rough
Default

Quote:
Originally Posted by Xephandor
This will return the error state of the query.

I know, the implementation sucks big time, but it may work.
may, should... all in live is relative (?)

For Eli2:

Code:
String... === String[]
And

Code:
String[]... === String[][]
__________________
"Nunca un científico ha quemado a un religioso por afirmar a Dios sin pruebas". Manuel Toharia
"uno empieza a darse cuenta que eso de no hacer ejercicio, comer y beber como si fuese la ultima cena y mantener la figura ya no existe...". Maryan
arlick no ha iniciado sesión   Reply With Quote
Old 04-02-2009, 11:28 PM   #13
Mattdoesrock
Count
 
Mattdoesrock's Avatar
 
Join Date: Jan 2008
Location: England, UK.
Posts: 1,055
Mattdoesrock will become famous soon enoughMattdoesrock will become famous soon enough
Default

Code:
String... ===
(?)

__________________
MattdoesJOKE_#40_NOT_FOUND
RA / Hor... Haven?
Mattdoesrock no ha iniciado sesión   Reply With Quote
Old 04-02-2009, 11:45 PM   #14
ArcticWolf
Duke
 
ArcticWolf's Avatar
 
Join Date: Nov 2006
Location: 0x00CAFE
Posts: 3,366
ArcticWolf is a glorious beacon of lightArcticWolf is a glorious beacon of lightArcticWolf is a glorious beacon of lightArcticWolf is a glorious beacon of lightArcticWolf is a glorious beacon of light
Default

Quote:
Originally Posted by Mattdoesrock
Wait, you haven't seen the new Thread() yet!
__________________
I don't have a solution, but I admire the problem.
ArcticWolf no ha iniciado sesión   Reply With Quote
Old 04-03-2009, 01:28 AM   #15
Eli2
Apprentice
 
Eli2's Avatar
 
Join Date: Jun 2007
Posts: 73
Eli2 is on a distinguished road
Default

Ah ok
I have never seen this syntax, and never needed to use it.
Although it seems to be really common.

http://en.wikipedia.org/wiki/Variadic_function
__________________
Regnum: It's Highly Addictive!
Eli2 no ha iniciado sesión   Reply With Quote
Old 04-03-2009, 01:29 AM   #16
Mattdoesrock
Count
 
Mattdoesrock's Avatar
 
Join Date: Jan 2008
Location: England, UK.
Posts: 1,055
Mattdoesrock will become famous soon enoughMattdoesrock will become famous soon enough
Default

Quote:
Originally Posted by Xephandor
Wait, you haven't seen the new Thread() yet!


?
__________________
MattdoesJOKE_#40_NOT_FOUND
RA / Hor... Haven?
Mattdoesrock no ha iniciado sesión   Reply With Quote
Old 04-03-2009, 01:59 AM   #17
ArcticWolf
Duke
 
ArcticWolf's Avatar
 
Join Date: Nov 2006
Location: 0x00CAFE
Posts: 3,366
ArcticWolf is a glorious beacon of lightArcticWolf is a glorious beacon of lightArcticWolf is a glorious beacon of lightArcticWolf is a glorious beacon of lightArcticWolf is a glorious beacon of light
Default

Quote:
Originally Posted by Eli2
Ah ok
I have never seen this syntax, and never needed to use it.
Although it seems to be really common.

http://en.wikipedia.org/wiki/Variadic_function
A lot of people like it, and I use it from time to time...

Another improvement in Java 1.5 were the for-each loops. REALLY useful when you just want to iterate a list, it saves a lot of typing (and you know that most of the bugs come from typos).
__________________
I don't have a solution, but I admire the problem.
ArcticWolf no ha iniciado sesión   Reply With Quote
Old 04-03-2009, 02:45 AM   #18
Miraculix
Count
 
Miraculix's Avatar
 
Join Date: Nov 2007
Location: Infinite Improbability Drive
Posts: 1,287
Miraculix will become famous soon enough
Default

Quote:
Originally Posted by Eli2
Ah ok
I have never seen this syntax, and never needed to use it.
Although it seems to be really common.

http://en.wikipedia.org/wiki/Variadic_function
printf() is a variadic function, as is any function that takes a variable amount of arguments. It's really common
__________________
Hit me, nail me, make me God.
Panoramix :: Half Elf Hunter ## Miraculix :: Half Elf Marksman ## Aspirinix :: Wood Elf Conjurer
Syrtis :: Horus :: Antartes
Miraculix no ha iniciado sesión   Reply With Quote
Old 04-03-2009, 03:59 AM   #19
ArcticWolf
Duke
 
ArcticWolf's Avatar
 
Join Date: Nov 2006
Location: 0x00CAFE
Posts: 3,366
ArcticWolf is a glorious beacon of lightArcticWolf is a glorious beacon of lightArcticWolf is a glorious beacon of lightArcticWolf is a glorious beacon of lightArcticWolf is a glorious beacon of light
Default

Quote:
Originally Posted by Miraculix
printf() is a variadic function, as is any function that takes a variable amount of arguments. It's really common
I don't know why, but I don't like printf.
__________________
I don't have a solution, but I admire the problem.
ArcticWolf no ha iniciado sesión   Reply With Quote
Old 04-03-2009, 11:23 AM   #20
arlick
Duke
 
arlick's Avatar
 
Join Date: Jan 2007
Posts: 3,939
arlick is a jewel in the rougharlick is a jewel in the rougharlick is a jewel in the rough
Default

Quote:
Originally Posted by Xephandor
I don't know why, but I don't like printf.
printf rules noob! (?)

I have discovered the java's printf (this is real, and i like it!)

String.format()
__________________
"Nunca un científico ha quemado a un religioso por afirmar a Dios sin pruebas". Manuel Toharia
"uno empieza a darse cuenta que eso de no hacer ejercicio, comer y beber como si fuese la ultima cena y mantener la figura ya no existe...". Maryan
arlick no ha iniciado sesión   Reply With Quote
Reply

Tags
regnum time, surak


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:19 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
NGD Studios 2002-2024 © All rights reserved