Ivan, todo bugs // Changing a db
Ruslan Zasukhin
sunshine at public.kherson.ua
Fri Jul 22 22:52:44 CDT 2005
On 7/22/05 10:36 PM, "jda" <jda at his.com> wrote:
Ivan, please check this.
> Hi Ruslan,
>
> A few questions here.
>
> I need to change the length of a string field when updating a
> database (API way). I want the length to go from 10 to 24.
>
> To do this, I try to open the old (original) db and get an exception
> (schema doesn't match). Fine.
>
> I then open the db as a VDatabase and try
>
> vdb.Table("format").StringField("sepLastNamesWith").MaxLength = 24
>
> This works, BUT all the records after the first record had their data deleted!
>
> That's the first problem.
>
> Then I found I COULD do this the SQL way and it worked, preserving
> all data. I used this:
>
> call vdb.SQLExecute("ALTER TABLE format CHANGE sepLastNamesWith
> sepLastNamesWith String (24)")
>
> But then when the db was opened again the API way I got an error:
>
> Schema does not match (field sepLastNamesWith -- wrong NULLABLE status).
>
> So now I'm doing this, which works:
>
> if vdb.Table("format").StringField("sepLastNamesWith").MaxLength < 24 then
> call vdb.SQLExecute("ALTER TABLE format CHANGE
> sepLastNamesWith sepLastNamesWith String (24)")
> vdb.Table("format").StringField("sepLastNamesWith").IsNullable =
> false
> end if
>
> As you can see, I'm mixing API and SQL commands. But it works! In
> V1.x you told us not to do this. Will it cause problems in V2?
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the Valentina-beta
mailing list