[DEVELOPMENT ENVIRONMENT]
* BUG: Fix table creation and renaming dialog when checking if a table name already exists. [GB.DB] * BUG: Table quoting works as expected now. [GB.DB.POSTGRESQL] * NEW: Now, if no schema is specified in a table name, the "public" schema is used. Consequently, the schema must be specified, unless the table is in the "public" schema. git-svn-id: svn://localhost/gambas/trunk@2443 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
83d84d7ee5
commit
71db2b5689
@ -350,7 +350,7 @@ msgstr ""
|
|||||||
#: FCommit.class:391 FConnectionEditor.class:398 FCreateFile.class:879
|
#: FCommit.class:391 FConnectionEditor.class:398 FCreateFile.class:879
|
||||||
#: FFontChooser.class:80 FGotoLine.class:57 FList.class:333 FMain.class:2768
|
#: FFontChooser.class:80 FGotoLine.class:57 FList.class:333 FMain.class:2768
|
||||||
#: FMakeExecutable.class:138 FMenu.class:1091 FNewConnection.class:586
|
#: FMakeExecutable.class:138 FMenu.class:1091 FNewConnection.class:586
|
||||||
#: FNewTable.class:161 FNewTranslation.class:64 FOpenProject.class:433
|
#: FNewTable.class:162 FNewTranslation.class:64 FOpenProject.class:433
|
||||||
#: FPasteSpecial.class:273 FPropertyProject.class:252
|
#: FPasteSpecial.class:273 FPropertyProject.class:252
|
||||||
#: FSelectExtraFile.class:72 FSelectIcon.class:266 FTableChooser.class:139
|
#: FSelectExtraFile.class:72 FSelectIcon.class:266 FTableChooser.class:139
|
||||||
#: FText.class:101
|
#: FText.class:101
|
||||||
@ -438,7 +438,7 @@ msgstr ""
|
|||||||
#: FFontChooser.class:86 FForm.class:2821 FGotoLine.class:63
|
#: FFontChooser.class:86 FForm.class:2821 FGotoLine.class:63
|
||||||
#: FIconEditor.class:1393 FImportTable.class:38 FList.class:155
|
#: FIconEditor.class:1393 FImportTable.class:38 FList.class:155
|
||||||
#: FMain.class:203 FMakeExecutable.class:144 FMakeInstall.class:309
|
#: FMain.class:203 FMakeExecutable.class:144 FMakeInstall.class:309
|
||||||
#: FMenu.class:1097 FNewConnection.class:317 FNewTable.class:167
|
#: FMenu.class:1097 FNewConnection.class:317 FNewTable.class:168
|
||||||
#: FNewTranslation.class:70 FOpenProject.class:146 FPasteSpecial.class:279
|
#: FNewTranslation.class:70 FOpenProject.class:146 FPasteSpecial.class:279
|
||||||
#: FPropertyProject.class:1236 FSave.class:118 FSelectExtraFile.class:78
|
#: FPropertyProject.class:1236 FSave.class:118 FSelectExtraFile.class:78
|
||||||
#: FSelectIcon.class:271 FTableChooser.class:145 FTextEditor.class:462
|
#: FSelectIcon.class:271 FTableChooser.class:145 FTextEditor.class:462
|
||||||
@ -475,31 +475,31 @@ msgid ""
|
|||||||
"Some files are not versioned and should be added manually to the repository."
|
"Some files are not versioned and should be added manually to the repository."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FCommit.class:234 FConflict.class:327 FConnectionEditor.class:1783
|
#: FCommit.class:234 FConflict.class:327 FConnectionEditor.class:1777
|
||||||
#: FEditor.class:3200 FForm.class:3360 FIconEditor.class:2168
|
#: FEditor.class:3200 FForm.class:3360 FIconEditor.class:2168
|
||||||
#: FOutput.class:473 FTextEditor.class:660
|
#: FOutput.class:473 FTextEditor.class:660
|
||||||
msgid "Cut"
|
msgid "Cut"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FCommit.class:241 FConflict.class:334 FConnectionEditor.class:1681
|
#: FCommit.class:241 FConflict.class:334 FConnectionEditor.class:1675
|
||||||
#: FEditor.class:3206 FForm.class:3367 FIconEditor.class:2177
|
#: FEditor.class:3206 FForm.class:3367 FIconEditor.class:2177
|
||||||
#: FOutput.class:480 FTextEditor.class:667
|
#: FOutput.class:480 FTextEditor.class:667
|
||||||
msgid "Copy"
|
msgid "Copy"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FCommit.class:248 FConflict.class:341 FConnectionEditor.class:1807
|
#: FCommit.class:248 FConflict.class:341 FConnectionEditor.class:1801
|
||||||
#: FEditor.class:3213 FForm.class:3374 FIconEditor.class:2186
|
#: FEditor.class:3213 FForm.class:3374 FIconEditor.class:2186
|
||||||
#: FOutput.class:487 FTextEditor.class:674
|
#: FOutput.class:487 FTextEditor.class:674
|
||||||
msgid "Paste"
|
msgid "Paste"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FCommit.class:255 FConflict.class:348 FConnectionEditor.class:1815
|
#: FCommit.class:255 FConflict.class:348 FConnectionEditor.class:1809
|
||||||
#: FEditor.class:3183 FForm.class:3602 FIconEditor.class:2150
|
#: FEditor.class:3183 FForm.class:3602 FIconEditor.class:2150
|
||||||
#: FOption.class:1136 FOutput.class:455 FTextEditor.class:642
|
#: FOption.class:1136 FOutput.class:455 FTextEditor.class:642
|
||||||
msgid "Undo"
|
msgid "Undo"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FCommit.class:262 FConflict.class:355 FConnectionEditor.class:1823
|
#: FCommit.class:262 FConflict.class:355 FConnectionEditor.class:1817
|
||||||
#: FEditor.class:3190 FForm.class:3613 FOutput.class:462 FTextEditor.class:649
|
#: FEditor.class:3190 FForm.class:3613 FOutput.class:462 FTextEditor.class:649
|
||||||
msgid "Redo"
|
msgid "Redo"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -620,12 +620,12 @@ msgstr ""
|
|||||||
|
|
||||||
#: FConnectionEditor.class:32 FCreateFile.class:733 FCreateProject.class:640
|
#: FConnectionEditor.class:32 FCreateFile.class:733 FCreateProject.class:640
|
||||||
#: FDebugInfo.class:30 FMenu.class:884 FNewConnection.class:394
|
#: FDebugInfo.class:30 FMenu.class:884 FNewConnection.class:394
|
||||||
#: FNewTable.class:111
|
#: FNewTable.class:112
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:37 FCreateFile.class:786 FCreateProject.class:368
|
#: FConnectionEditor.class:37 FCreateFile.class:786 FCreateProject.class:368
|
||||||
#: FInfo.class:333 FNewConnection.class:409 FNewTable.class:127
|
#: FInfo.class:333 FNewConnection.class:409 FNewTable.class:128
|
||||||
#: FPropertyProject.class:889
|
#: FPropertyProject.class:889
|
||||||
msgid "Type"
|
msgid "Type"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -776,80 +776,80 @@ msgstr ""
|
|||||||
msgid "Remove"
|
msgid "Remove"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1525
|
#: FConnectionEditor.class:1519
|
||||||
msgid "Connection editor"
|
msgid "Connection editor"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1540 FEditor.class:2128 FForm.class:2821
|
#: FConnectionEditor.class:1534 FEditor.class:2128 FForm.class:2821
|
||||||
#: FIconEditor.class:2032 FTextEditor.class:462 FTranslate.class:700
|
#: FIconEditor.class:2032 FTextEditor.class:462 FTranslate.class:700
|
||||||
msgid "Reload"
|
msgid "Reload"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1548 FNewTable.class:97
|
#: FConnectionEditor.class:1542 FNewTable.class:98
|
||||||
msgid "New table"
|
msgid "New table"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1555
|
#: FConnectionEditor.class:1549
|
||||||
msgid "Delete table"
|
msgid "Delete table"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1562 FNewTable.class:29
|
#: FConnectionEditor.class:1556 FNewTable.class:30
|
||||||
msgid "Rename table"
|
msgid "Rename table"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1564
|
#: FConnectionEditor.class:1558
|
||||||
msgid "Rename..."
|
msgid "Rename..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1570
|
#: FConnectionEditor.class:1564
|
||||||
msgid "Import text file"
|
msgid "Import text file"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1572
|
#: FConnectionEditor.class:1566
|
||||||
msgid "Import..."
|
msgid "Import..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1578
|
#: FConnectionEditor.class:1572
|
||||||
msgid "SQL request"
|
msgid "SQL request"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1637
|
#: FConnectionEditor.class:1631
|
||||||
msgid "Fields"
|
msgid "Fields"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1654 FMain.class:1609
|
#: FConnectionEditor.class:1648 FMain.class:1609
|
||||||
msgid "Add"
|
msgid "Add"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1668
|
#: FConnectionEditor.class:1662
|
||||||
msgid "Down"
|
msgid "Down"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1675
|
#: FConnectionEditor.class:1669
|
||||||
msgid "Up"
|
msgid "Up"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1683
|
#: FConnectionEditor.class:1677
|
||||||
msgid "Copy field list"
|
msgid "Copy field list"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1700
|
#: FConnectionEditor.class:1694
|
||||||
msgid "Indexes"
|
msgid "Indexes"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1718
|
#: FConnectionEditor.class:1712
|
||||||
msgid "New index"
|
msgid "New index"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1777
|
#: FConnectionEditor.class:1771
|
||||||
msgid "Run query"
|
msgid "Run query"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1831
|
#: FConnectionEditor.class:1825
|
||||||
msgid "Test"
|
msgid "Test"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FConnectionEditor.class:1888
|
#: FConnectionEditor.class:1882
|
||||||
msgid "Export..."
|
msgid "Export..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -2851,15 +2851,15 @@ msgstr ""
|
|||||||
msgid "Ignore database charset"
|
msgid "Ignore database charset"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FNewTable.class:32
|
#: FNewTable.class:33
|
||||||
msgid "Create table"
|
msgid "Create table"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FNewTable.class:52
|
#: FNewTable.class:53
|
||||||
msgid "Please enter the name of the new table."
|
msgid "Please enter the name of the new table."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: FNewTable.class:58 MConnection.module:277
|
#: FNewTable.class:59 MConnection.module:272
|
||||||
msgid "Table '&1' already exists."
|
msgid "Table '&1' already exists."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -3882,7 +3882,7 @@ msgstr ""
|
|||||||
msgid "Unknown"
|
msgid "Unknown"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: MConnection.module:290
|
#: MConnection.module:285
|
||||||
msgid "Cannot create table '&1'."
|
msgid "Cannot create table '&1'."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -258,12 +258,7 @@ Public Function CountTableData(Handle As Connection, sTable As String) As Intege
|
|||||||
Dim rResult As Result
|
Dim rResult As Result
|
||||||
Dim iPos As Integer
|
Dim iPos As Integer
|
||||||
|
|
||||||
iPos = InStr(sTable, ".")
|
rResult = Handle.Exec("SELECT COUNT(*) AS nRecord FROM " & Handle.Quote(sTable, True))
|
||||||
If iPos Then
|
|
||||||
rResult = Handle.Exec("SELECT COUNT(*) AS nRecord FROM " & Left(sTable, iPos) & Handle.Quote(Mid$(sTable, iPos + 1)))
|
|
||||||
Else
|
|
||||||
rResult = Handle.Exec("SELECT COUNT(*) AS nRecord FROM " & Handle.Quote(sTable))
|
|
||||||
Endif
|
|
||||||
Return rResult!nRecord
|
Return rResult!nRecord
|
||||||
|
|
||||||
End
|
End
|
||||||
|
@ -407,7 +407,7 @@ Public Sub tbvField_Data(Row As Integer, Column As Integer)
|
|||||||
|
|
||||||
Dim hCField As CField
|
Dim hCField As CField
|
||||||
|
|
||||||
hCField = $aField[Row]
|
Try hCField = $aField[Row]
|
||||||
If Not hCField Then Return
|
If Not hCField Then Return
|
||||||
|
|
||||||
With tbvField.Data
|
With tbvField.Data
|
||||||
@ -1250,7 +1250,7 @@ Public Sub btnNewTable_Click()
|
|||||||
aType = ["MyISAM", "MERGE", "HEAP", "InnoDB", "BDB", "ISAM"]
|
aType = ["MyISAM", "MERGE", "HEAP", "InnoDB", "BDB", "ISAM"]
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
If FNewTable.Run("", "InnoDB", aType) Then Return
|
If FNewTable.Run($hConn, "", "InnoDB", aType) Then Return
|
||||||
sName = FNewTable.TableName
|
sName = FNewTable.TableName
|
||||||
|
|
||||||
If MConnection.CreateTable($hConn, sName, FNewTable.Type) Then Return
|
If MConnection.CreateTable($hConn, sName, FNewTable.Type) Then Return
|
||||||
@ -1336,7 +1336,7 @@ Public Sub btnRename_Click()
|
|||||||
If $bReadOnly Then Return
|
If $bReadOnly Then Return
|
||||||
If SaveTable() Then Return
|
If SaveTable() Then Return
|
||||||
|
|
||||||
If FNewTable.Run($sTable, $sType) Then Return
|
If FNewTable.Run($hConn, $sTable, $sType) Then Return
|
||||||
|
|
||||||
sNewName = FNewTable.TableName
|
sNewName = FNewTable.TableName
|
||||||
If Not sNewName Then Return
|
If Not sNewName Then Return
|
||||||
@ -1436,13 +1436,7 @@ End
|
|||||||
|
|
||||||
Public Sub ToolButton1_Click()
|
Public Sub ToolButton1_Click()
|
||||||
|
|
||||||
Dim sStr As String
|
Print $hConn.Quote("haddock")
|
||||||
Dim iInd As Integer
|
Print $hConn.Quote("haddock", True)
|
||||||
|
|
||||||
For iInd = 0 To 255
|
|
||||||
sStr &= Chr$(iInd)
|
|
||||||
Next
|
|
||||||
|
|
||||||
Print $hConn.FormatBlob(sStr)
|
|
||||||
|
|
||||||
End
|
End
|
||||||
|
@ -5,11 +5,12 @@ Static Public TableType As String
|
|||||||
|
|
||||||
Static Private $aType As String[]
|
Static Private $aType As String[]
|
||||||
|
|
||||||
Static Public Function Run(Optional sTable As String, Optional sType As String, Optional aType As String[]) As Boolean
|
Static Public Function Run(hConn As Connection, Optional sTable As String, Optional sType As String, Optional aType As String[]) As Boolean
|
||||||
|
|
||||||
TableName = sTable
|
TableName = sTable
|
||||||
TableType = sType
|
TableType = sType
|
||||||
$aType = aType
|
$aType = aType
|
||||||
|
DB.Current = hConn
|
||||||
Return Not FNewTable.ShowModal()
|
Return Not FNewTable.ShowModal()
|
||||||
|
|
||||||
End
|
End
|
||||||
|
@ -199,7 +199,8 @@ static bool get_table_schema(const char **table, char **schema)
|
|||||||
if (!point)
|
if (!point)
|
||||||
{
|
{
|
||||||
//fprintf(stderr, "get_table_schema: -> No point\n");
|
//fprintf(stderr, "get_table_schema: -> No point\n");
|
||||||
return TRUE;
|
*schema = "public";
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GB.TempString(schema, *table, point - *table);
|
GB.TempString(schema, *table, point - *table);
|
||||||
@ -1385,11 +1386,15 @@ static int table_exist(DB_DATABASE *db, const char *table)
|
|||||||
"and (relnamespace not in (select oid from pg_namespace where nspname = 'information_schema'))";
|
"and (relnamespace not in (select oid from pg_namespace where nspname = 'information_schema'))";
|
||||||
|
|
||||||
const char *query_schema =
|
const char *query_schema =
|
||||||
"select pg_class.relname,pg_namespace.nspname from pg_class,pg_namespace where (pg_class.relkind = 'r' or pg_class.relkind = 'v') "
|
"select relname from pg_class where (relkind = 'r' or relkind = 'v') "
|
||||||
|
"and (relname = '&1') "
|
||||||
|
"and (relnamespace in (select oid from pg_namespace where nspname = '&2'))";
|
||||||
|
|
||||||
|
/*"select pg_class.relname,pg_namespace.nspname from pg_class,pg_namespace where (pg_class.relkind = 'r' or pg_class.relkind = 'v') "
|
||||||
"and (pg_namespace.oid = pg_class.relnamespace) "
|
"and (pg_namespace.oid = pg_class.relnamespace) "
|
||||||
"and (pg_class.relname = '&1') "
|
"and (pg_class.relname = '&1') "
|
||||||
"and (pg_namespace.nspname = '&2') "
|
"and (pg_namespace.nspname = '&2') "
|
||||||
"and (pg_namespace.oid not in (select oid from pg_namespace where nspname = 'information_schema'))";
|
"and (pg_namespace.oid not in (select oid from pg_namespace where nspname = 'information_schema'))";*/
|
||||||
|
|
||||||
PGresult *res;
|
PGresult *res;
|
||||||
int exist;
|
int exist;
|
||||||
@ -1453,7 +1458,7 @@ static int table_list_73(DB_DATABASE *db, char ***tables)
|
|||||||
for (i = 0; i < PQntuples(res); i++)
|
for (i = 0; i < PQntuples(res); i++)
|
||||||
{
|
{
|
||||||
schema = PQgetvalue(res, i, 1);
|
schema = PQgetvalue(res, i, 1);
|
||||||
if (!strcmp(schema, "public") || !strcmp(schema, "pg_catalog"))
|
if (!strcmp(schema, "public")) // || !strcmp(schema, "pg_catalog"))
|
||||||
GB.NewString(&((*tables)[i]), PQgetvalue(res, i, 0), 0);
|
GB.NewString(&((*tables)[i]), PQgetvalue(res, i, 0), 0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -584,7 +584,7 @@ char *DB_GetQuotedTable(DB_DRIVER *driver, DB_DATABASE *db, const char *table)
|
|||||||
if (!point)
|
if (!point)
|
||||||
{
|
{
|
||||||
GB.TempString(&res, NULL, len + 2);
|
GB.TempString(&res, NULL, len + 2);
|
||||||
sprintf(res, "%s%s%s", table, quote, quote);
|
sprintf(res, "%s%s%s", quote, table, quote);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user