mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Fixed encoding issues in MySql, new ExportIds utility (in Sql) creates a file of SQLID constants for given database
git-svn-id: svn://ultimatepp.org/upp/trunk@361 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
be14fe1e48
commit
2fe3327c8e
4 changed files with 69 additions and 17 deletions
|
|
@ -47,7 +47,7 @@ String ExportSch(SqlSession& session, const String& database)
|
|||
break;
|
||||
}
|
||||
r << '\t' << sPutId(type, id, c[i].name, 8);
|
||||
if(width > 0 && width < 4000)
|
||||
if(width > 0 && width < 40000)
|
||||
r << ", " << width;
|
||||
r << ")\r\n";
|
||||
}
|
||||
|
|
@ -61,4 +61,35 @@ String ExportSch(const String& database)
|
|||
return ExportSch(SQL.GetSession(), database);
|
||||
}
|
||||
|
||||
static void sId(String& r, const String& id, Index<String>& done)
|
||||
{
|
||||
String u = ToUpper(id);
|
||||
if(done.Find(u) >= 0)
|
||||
return;
|
||||
done.Add(u);
|
||||
if(u == id)
|
||||
r << "SQLID(" << id << ")\r\n";
|
||||
else
|
||||
r << "SQL_ID(" << u << ", " << id << ")\r\n";
|
||||
}
|
||||
|
||||
String ExportIds(SqlSession& session, const String& database)
|
||||
{
|
||||
String r;
|
||||
Vector<String> tab = session.EnumTables(database);
|
||||
Index<String> done;
|
||||
for(int i = 0; i < tab.GetCount(); i++) {
|
||||
sId(r, tab[i], done);
|
||||
Vector<SqlColumnInfo> c = session.EnumColumns(database, tab[i]);
|
||||
for(int i = 0; i < c.GetCount(); i++)
|
||||
sId(r, c[i].name, done);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
String ExportIds(const String& database)
|
||||
{
|
||||
return ExportIds(SQL.GetSession(), database);
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue