Hi Gulliver,
Thanks for your reply, I have a look at the database.cpp (version 0.3.6)
and as you suspected the new filed type isn't passed to sql query that
adds a new column.
So I made some changes in the database.cpp file and now it seems to work
either with Postgresql or sqlite3. Attached to this email you can find a
patch file that describes the file changes.
I don't know if this modification is good enough for all the cases, but
it works with the afore mentioned DBs.
However can you advise me when this bug will be solved?
Best regards,
Giovanni.
Gulliver ha scritto:
Hi,
After that I ran my code example, using an existing postgresql DB (created with the first
schema), but when the "upgrade" function was invoked this exception was raised:
Query:ALTER TABLE Point_backup ADD COLUMN h_; failed: ERROR: syntax error at or near
";"
LINE 1: ALTER TABLE Point_backup ADD COLUMN h_;
Probably postgresql needs the field type of new column, instead using sqlite3
db everything works fine. Can anyone tell me how can I solve this problem?
Yes, definitive, but sqlite not because it uses dynamic column types. This is a
bug, i thought it was fixed some months ago.
I have to look again on it, it must be somewhere in database.cpp.
Kind regards,
gulliver
------------------------------------------------------------------------
Nessun virus nel messaggio in arrivo.
Controllato da AVG - www.avg.com
Versione: 9.0.730 / Database dei virus: 270.14.150/2632 - Data di rilascio: 01/19/10 08:34:00
61a62,74
> ///////////////////////////////////////////////////////////////////////
> static Split getFieldsAndTypes(string schema) {
> Split s;
> int start = schema.find("(");
> int end = schema.find(")");
> if (start == -1 || end == -1)
> return s;
> Split tmp(replace(schema.substr(start+1, end), ", ", ","), ",");
> for (size_t i = 0; i < tmp.size(); i++)
> s.push_back(replace(tmp[i],")",""));
> return s;
> }
> ////////////////////////////////////////////////////////////////////////
82c95,102
< Split toAdd(newFields);
---
> Split toAdd(newFields);
>
> /////////////////////////////////////////////////////////////
> Split oldFieldsWithTypes = getFieldsAndTypes(oldSchema);
> Split newFieldsWithTypes = getFieldsAndTypes(newSchema);
> Split toAddWithTypes(newFieldsWithTypes);
> /////////////////////////////////////////////////////////////
>
103a124,134
>
> ////////////////////////////////////////////////////////////////////////////////////////
> for (Split::iterator it =
> oldFieldsWithTypes.begin();it!=oldFieldsWithTypes.end();it++)
> {
> found = find(toAddWithTypes.begin(),toAddWithTypes.end(),*it);
> if (found!=toAddWithTypes.end())
> {
> toAddWithTypes.erase(found);
> }
> }
>
> ////////////////////////////////////////////////////////////////////////////////////////
>
107c138,141
< for (Split::iterator it = toAdd.begin();it!= toAdd.end();it++)
---
>
>
> ////////////////////////////////////////////////////////////////////////////////////
> //toAddWithTypes replace toAdd
> for (Split::iterator it = toAddWithTypes.begin();it!=
> toAddWithTypes.end();it++)
110a145
>
> ////////////////////////////////////////////////////////////////////////////////////
Nessun virus nel messaggio in uscita.
Controllato da AVG - www.avg.com
Versione: 9.0.730 / Database dei virus: 270.14.151/2633 - Data di rilascio:
01/19/10 18:49:00
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Litesql-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/litesql-users