~grubng-dev/grubng/tools-urlsdb

« back to all changes in this revision

Viewing changes to Database.cs

  • Committer: thindil
  • Date: 2011-01-14 23:45:17 UTC
  • Revision ID: thindil2@gmail.com-20110114234517-g9u9ru5wuch8alcw
fixed SQL command for inserting URL's to database

Show diffs side-by-side

added added

removed removed

Lines of Context:
119
119
                                         "`user_crawl`, `user_robots`) VALUES");
120
120
                        if (fast)
121
121
                        {
122
 
                                int i = 0;
123
122
                                foreach(string url in dict.Keys)
124
123
                                {
125
124
                                        insertcmd.Append("(\"" + dict[url][0] + "\", \"" + url + 
126
 
                                                        "\", 0, 0, 0, 0, 0, 0, 0, 0, \"\", \"\")");
127
 
                                        if ((i > 0) && (i < dict.Keys.Count - 1))
128
 
                                        {
129
 
                                                insertcmd.Append(",");
130
 
                                        }
131
 
                                        i++;
 
125
                                                        "\", 0, 0, 0, 0, 0, 0, 0, 0, \"\", \"\"),");
132
126
                                }
133
127
                                any = true;
134
128
                        }
156
150
                                                                if (!reader.Read())
157
151
                                                                {       
158
152
                                                                        insertcmd.Append("(\"" + dict[keys[i]][0] + "\", \"" + keys[i] + 
159
 
                                                                                         "\", 0, 0, 0, 0, 0, 0, 0, 0, \"\", \"\")");
160
 
                                                                        if ((i > 0) && (i < commands.Count - 1))
161
 
                                                                        {
162
 
                                                                                insertcmd.Append(",");
163
 
                                                                        }
 
153
                                                                                         "\", 0, 0, 0, 0, 0, 0, 0, 0, \"\", \"\"),");
164
154
                                                                        any = true;
165
155
                                                                }
166
156
                                                                reader.Close();
169
159
                                        }
170
160
                                        if (any)
171
161
                                        {
172
 
                                                insertcmd.Append(";");
173
 
                                                dbcmd.CommandText = insertcmd.ToString();
 
162
                                                dbcmd.CommandText = insertcmd.ToString().TrimEnd(new char[] {','}) + ";";
174
163
                                                amount = dbcmd.ExecuteNonQuery();
175
164
                                        }
176
165
                                }