Home » U++ Library support » U++ Core » Limitation in Format() function?
Limitation in Format() function? [message #13638] |
Fri, 18 January 2008 12:02 |
alex100
Messages: 118 Registered: November 2007
|
Experienced Member |
|
|
Hi
I am trying to send an SQL command to SQLite database and I an building it using the Format function. Target databse table has lots of fields.
IF I use more then ten % in the first argunt of the Format function and erro appears like this:
error: invalid conversion from `const char*' to `int'
error: initializing argument 1 of `Upp::String Upp::Format(int, const char*,Upp::Value, Upp::Value, Upp::Value,Upp::Value, Upp::Value, Upp::Value, Upp::Value, Upp::Value, Upp::Value, Upp::
Value)'
Example:
This works: strSQL=Format("( ...) %d,'%0.2d-%0.2d-%0.2d','%s',%d,'%s','%0.2d-%0.2d-%0.2d')",1,2008,1,1, "aaa",1,"aaa",2008,1,1);
This doesnt works: strSQL=Format("( ...) %d,'%0.2d-%0.2d-%0.2d','%s',%d,'%s','%0.2d-%0.2d-%0.2d',%d)",1,2008,1,1, "aaa",1,"aaa",2008,1,1,1);
Is that a limitation?
Alex
|
|
|
Re: Limitation in Format() function? [message #13640 is a reply to message #13638] |
Fri, 18 January 2008 15:28 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
alex100 wrote on Fri, 18 January 2008 06:02 | Hi
I am trying to send an SQL command to SQLite database and I an building it using the Format function. Target databse table has lots of fields.
IF I use more then ten % in the first argunt of the Format function and erro appears like this:
error: invalid conversion from `const char*' to `int'
error: initializing argument 1 of `Upp::String Upp::Format(int, const char*,Upp::Value, Upp::Value, Upp::Value,Upp::Value, Upp::Value, Upp::Value, Upp::Value, Upp::Value, Upp::Value, Upp::
Value)'
Example:
This works: strSQL=Format("( ...) %d,'%0.2d-%0.2d-%0.2d','%s',%d,'%s','%0.2d-%0.2d-%0.2d')",1,2008,1,1, "aaa",1,"aaa",2008,1,1);
This doesnt works: strSQL=Format("( ...) %d,'%0.2d-%0.2d-%0.2d','%s',%d,'%s','%0.2d-%0.2d-%0.2d',%d)",1,2008,1,1, "aaa",1,"aaa",2008,1,1,1);
Is that a limitation?
Alex
|
Yes, currently, Format is limited to 10 parameters. Adding more is simple, but slightly increases the size of any linux binary using Format...
You can also use:
String Format(const char *s, const Vector<Value>& v);
- that has no limit at all.
Should I increase the limit?
Mirek
|
|
|
|
|
Goto Forum:
Current Time: Sun May 05 06:27:08 CEST 2024
Total time taken to generate the page: 0.01853 seconds
|