> Patch against FB HEAD in attach.

    Thanks.

    After quick review i want to point to a trivial bug in 
NBackup::backup_database()

   short null_flag = 0;
-  in_sqlda->sqlvar[0].sqldata = (char*) &level;
-  in_sqlda->sqlvar[0].sqlind = &null_flag;
+  if (level >= 0)
+  {
+   in_sqlda->sqlvar[0].sqldata = (char*) &level;
+   in_sqlda->sqlvar[0].sqlind = &null_flag;
+  }
+  else
+  {
+   short null_ind = -1;
+   in_sqlda->sqlvar[0].sqldata = NULL;
+   in_sqlda->sqlvar[0].sqlind = &null_ind;
+  }

    Here you use local variable "null_ind" after is goes out of scope. BTW, i 
see
no need to new variable "null_ind" as there is already "null_flag" - all you 
need
is to assign -1 to it in "else" branch. So, this part of patch could be like 
below :

   short null_flag = 0;
-  in_sqlda->sqlvar[0].sqldata = (char*) &level;
  in_sqlda->sqlvar[0].sqlind = &null_flag;
+  if (level >= 0)
+  {
+   in_sqlda->sqlvar[0].sqldata = (char*) &level;
+  }
+  else
+  {
+   null_flag  = -1;
+   in_sqlda->sqlvar[0].sqldata = NULL;
+  }


    Also, i wonder - why do you use "first 1" in this query ?

        select first 1 rdb$guid, rdb$scn from rdb$backup_history 
         where rdb$guid = '%s

And, at last, i guess it requires index on rdb$backup_history.rdb$guid.


Regards,
Vlad


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to