[GB.DB.SQLITE2]
* BUG: Quote index name and primary key fields. git-svn-id: svn://localhost/gambas/trunk@5528 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
00c989eb44
commit
55d0e29eec
1 changed files with 1397 additions and 1391 deletions
|
@ -1491,7 +1491,9 @@ static int table_create(DB_DATABASE *db, const char *table, DB_FIELD *fields, ch
|
|||
if (i > 0)
|
||||
DB.Query.Add(",");
|
||||
|
||||
DB.Query.Add(QUOTE_STRING);
|
||||
DB.Query.Add(primary[i]);
|
||||
DB.Query.Add(QUOTE_STRING);
|
||||
}
|
||||
|
||||
DB.Query.Add(")");
|
||||
|
@ -1880,10 +1882,14 @@ static int index_create(DB_DATABASE *db, const char *table, const char *index, D
|
|||
DB.Query.Add("CREATE ");
|
||||
if (info->unique)
|
||||
DB.Query.Add("UNIQUE ");
|
||||
DB.Query.Add("INDEX '");
|
||||
DB.Query.Add("INDEX ");
|
||||
DB.Query.Add(QUOTE_STRING);
|
||||
DB.Query.Add(index);
|
||||
DB.Query.Add("' ON ");
|
||||
DB.Query.Add(QUOTE_STRING);
|
||||
DB.Query.Add(" ON ");
|
||||
DB.Query.Add(QUOTE_STRING);
|
||||
DB.Query.Add(table);
|
||||
DB.Query.Add(QUOTE_STRING);
|
||||
DB.Query.Add(" ( ");
|
||||
DB.Query.Add(info->fields);
|
||||
DB.Query.Add(" )");
|
||||
|
@ -1892,18 +1898,18 @@ static int index_create(DB_DATABASE *db, const char *table, const char *index, D
|
|||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* database_exist()
|
||||
*
|
||||
* Returns if a database exists
|
||||
*
|
||||
* <handle> is any database handle.
|
||||
* <name> is the database name.
|
||||
*
|
||||
* This function returns TRUE if the database exists, and FALSE if not.
|
||||
* SQLite: Databases are just files, so we need to ceck to see whether
|
||||
* the file exists and is a sqlite file.
|
||||
******************************************************************************/
|
||||
*
|
||||
* database_exist()
|
||||
*
|
||||
* Returns if a database exists
|
||||
*
|
||||
* <handle> is any database handle.
|
||||
* <name> is the database name.
|
||||
*
|
||||
* This function returns TRUE if the database exists, and FALSE if not.
|
||||
* SQLite: Databases are just files, so we need to ceck to see whether
|
||||
* the file exists and is a sqlite file.
|
||||
******************************************************************************/
|
||||
static int database_exist(DB_DATABASE *db, const char *name)
|
||||
{
|
||||
SqliteDatabase *conn = (SqliteDatabase *)db->handle;
|
||||
|
@ -1922,23 +1928,23 @@ static int database_exist(DB_DATABASE *db, const char *name)
|
|||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* database_list()
|
||||
*
|
||||
* Returns an array containing the name of each database
|
||||
*
|
||||
* <handle> is any database handle.
|
||||
* <databases> points to a variable that will receive the char* array.
|
||||
*
|
||||
* This function returns the number of databases, or -1 if the command has
|
||||
* failed.
|
||||
*
|
||||
* Be careful: <databases> can be NULL, so that just the count is returned.
|
||||
*
|
||||
* Sqlite databases are files. Using we will only list
|
||||
* files within a designated directory. Propose that all
|
||||
* areas are walked through.
|
||||
******************************************************************************/
|
||||
*
|
||||
* database_list()
|
||||
*
|
||||
* Returns an array containing the name of each database
|
||||
*
|
||||
* <handle> is any database handle.
|
||||
* <databases> points to a variable that will receive the char* array.
|
||||
*
|
||||
* This function returns the number of databases, or -1 if the command has
|
||||
* failed.
|
||||
*
|
||||
* Be careful: <databases> can be NULL, so that just the count is returned.
|
||||
*
|
||||
* Sqlite databases are files. Using we will only list
|
||||
* files within a designated directory. Propose that all
|
||||
* areas are walked through.
|
||||
******************************************************************************/
|
||||
|
||||
static int database_list(DB_DATABASE *db, char ***databases)
|
||||
{
|
||||
|
@ -1970,20 +1976,20 @@ static int database_list(DB_DATABASE *db, char ***databases)
|
|||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* database_is_system()
|
||||
*
|
||||
* Returns if a database is a system database.
|
||||
*
|
||||
* <handle> is any database handle.
|
||||
* <name> is the database name.
|
||||
*
|
||||
* This function returns TRUE if the database is a system database, and
|
||||
* FALSE if not.
|
||||
*
|
||||
* NOTE: Sqlite doesn't have such a thing.
|
||||
*
|
||||
******************************************************************************/
|
||||
*
|
||||
* database_is_system()
|
||||
*
|
||||
* Returns if a database is a system database.
|
||||
*
|
||||
* <handle> is any database handle.
|
||||
* <name> is the database name.
|
||||
*
|
||||
* This function returns TRUE if the database is a system database, and
|
||||
* FALSE if not.
|
||||
*
|
||||
* NOTE: Sqlite doesn't have such a thing.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static int database_is_system(DB_DATABASE *db, const char *name)
|
||||
{
|
||||
|
@ -1991,18 +1997,18 @@ static int database_is_system(DB_DATABASE *db, const char *name)
|
|||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* database_delete()
|
||||
*
|
||||
* Deletes a database.
|
||||
*
|
||||
* <handle> is the database handle.
|
||||
* <name> is the database name.
|
||||
*
|
||||
* This function returns TRUE if the command has failed, and FALSE if
|
||||
* everything was OK.
|
||||
*
|
||||
******************************************************************************/
|
||||
*
|
||||
* database_delete()
|
||||
*
|
||||
* Deletes a database.
|
||||
*
|
||||
* <handle> is the database handle.
|
||||
* <name> is the database name.
|
||||
*
|
||||
* This function returns TRUE if the command has failed, and FALSE if
|
||||
* everything was OK.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static int database_delete(DB_DATABASE *db, const char *name)
|
||||
{
|
||||
|
@ -2026,20 +2032,20 @@ static int database_delete(DB_DATABASE *db, const char *name)
|
|||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* database_create()
|
||||
*
|
||||
* Creates a database.
|
||||
*
|
||||
* <handle> is the database handle.
|
||||
* <name> is the database name.
|
||||
*
|
||||
* This function returns TRUE if the command has failed, and FALSE if
|
||||
* everything was OK.
|
||||
*
|
||||
* SQLite automatically creates a database on connect if the file
|
||||
* does not exist.
|
||||
******************************************************************************/
|
||||
*
|
||||
* database_create()
|
||||
*
|
||||
* Creates a database.
|
||||
*
|
||||
* <handle> is the database handle.
|
||||
* <name> is the database name.
|
||||
*
|
||||
* This function returns TRUE if the command has failed, and FALSE if
|
||||
* everything was OK.
|
||||
*
|
||||
* SQLite automatically creates a database on connect if the file
|
||||
* does not exist.
|
||||
******************************************************************************/
|
||||
|
||||
static int database_create(DB_DATABASE *db, const char *name)
|
||||
{
|
||||
|
@ -2104,23 +2110,23 @@ _CREATE_DATABASE:
|
|||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* user_exist()
|
||||
*
|
||||
* Returns if a user exists.
|
||||
*
|
||||
* <handle> is any database handle.
|
||||
* <name> is the user name.
|
||||
*
|
||||
* This function returns TRUE if the user exists, and FALSE if not.
|
||||
* Sqlite does not have different users. Access is controlled by
|
||||
* access rightd on the file.
|
||||
* We can check that the user exists on the machine and has access to
|
||||
* database file!
|
||||
* [Currently only checks against /etc/passwd.
|
||||
* Does not check against /etc/shadow or pam.
|
||||
*
|
||||
******************************************************************************/
|
||||
*
|
||||
* user_exist()
|
||||
*
|
||||
* Returns if a user exists.
|
||||
*
|
||||
* <handle> is any database handle.
|
||||
* <name> is the user name.
|
||||
*
|
||||
* This function returns TRUE if the user exists, and FALSE if not.
|
||||
* Sqlite does not have different users. Access is controlled by
|
||||
* access rightd on the file.
|
||||
* We can check that the user exists on the machine and has access to
|
||||
* database file!
|
||||
* [Currently only checks against /etc/passwd.
|
||||
* Does not check against /etc/shadow or pam.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static int user_exist(DB_DATABASE *db, const char *name)
|
||||
{
|
||||
|
@ -2206,21 +2212,21 @@ static int user_exist(DB_DATABASE *db, const char *name)
|
|||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* user_list()
|
||||
*
|
||||
* Returns an array containing the name of each user.
|
||||
*
|
||||
* <handle> is the database handle.
|
||||
* <users> points to a variable that will receive the char* array.
|
||||
*
|
||||
* This function returns the number of users, or -1 if the command has
|
||||
* failed.
|
||||
*
|
||||
* Be careful: <users> can be NULL, so that just the count is returned.
|
||||
* Sqlite does not have users.
|
||||
*
|
||||
******************************************************************************/
|
||||
*
|
||||
* user_list()
|
||||
*
|
||||
* Returns an array containing the name of each user.
|
||||
*
|
||||
* <handle> is the database handle.
|
||||
* <users> points to a variable that will receive the char* array.
|
||||
*
|
||||
* This function returns the number of users, or -1 if the command has
|
||||
* failed.
|
||||
*
|
||||
* Be careful: <users> can be NULL, so that just the count is returned.
|
||||
* Sqlite does not have users.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
static int user_list(DB_DATABASE *db, char ***users)
|
||||
|
@ -2325,22 +2331,22 @@ static int user_list(DB_DATABASE *db, char ***users)
|
|||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* user_info()
|
||||
*
|
||||
* Get user description
|
||||
*
|
||||
* <handle> is the database handle.
|
||||
* <name> is the user name.
|
||||
* <info> points to a structure filled by the function.
|
||||
*
|
||||
* This function returns TRUE if the command has failed, and FALSE if
|
||||
* everything was OK.
|
||||
*
|
||||
* Sqlite privileges are just file privileges. We will return Admin
|
||||
* rights where privilege allows Write. There is no password.
|
||||
*
|
||||
******************************************************************************/
|
||||
*
|
||||
* user_info()
|
||||
*
|
||||
* Get user description
|
||||
*
|
||||
* <handle> is the database handle.
|
||||
* <name> is the user name.
|
||||
* <info> points to a structure filled by the function.
|
||||
*
|
||||
* This function returns TRUE if the command has failed, and FALSE if
|
||||
* everything was OK.
|
||||
*
|
||||
* Sqlite privileges are just file privileges. We will return Admin
|
||||
* rights where privilege allows Write. There is no password.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
static int user_info(DB_DATABASE *db, const char *name, DB_USER *info )
|
||||
{
|
||||
|
@ -2404,21 +2410,21 @@ static int user_delete(DB_DATABASE *db, const char *name)
|
|||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* user_create()
|
||||
*
|
||||
* Creates a user.
|
||||
*
|
||||
* <handle> is the database handle.
|
||||
* <name> is the user name.
|
||||
* <info> points to a structure describing the user.
|
||||
*
|
||||
* This function returns TRUE if the command has failed, and FALSE if
|
||||
* everything was OK.
|
||||
*
|
||||
*
|
||||
* Sqlite: No user create
|
||||
******************************************************************************/
|
||||
*
|
||||
* user_create()
|
||||
*
|
||||
* Creates a user.
|
||||
*
|
||||
* <handle> is the database handle.
|
||||
* <name> is the user name.
|
||||
* <info> points to a structure describing the user.
|
||||
*
|
||||
* This function returns TRUE if the command has failed, and FALSE if
|
||||
* everything was OK.
|
||||
*
|
||||
*
|
||||
* Sqlite: No user create
|
||||
******************************************************************************/
|
||||
|
||||
static int user_create(DB_DATABASE *db, const char *name, DB_USER *info)
|
||||
{
|
||||
|
@ -2427,20 +2433,20 @@ static int user_create(DB_DATABASE *db, const char *name, DB_USER *info)
|
|||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* user_set_password()
|
||||
*
|
||||
* Change the user password.
|
||||
*
|
||||
* <handle> is the database handle.
|
||||
* <name> is the user name.
|
||||
* <password> is the new password
|
||||
*
|
||||
* This function returns TRUE if the command has failed, and FALSE if
|
||||
* everything was OK.
|
||||
*
|
||||
* Sqlite : No user passwords.
|
||||
******************************************************************************/
|
||||
*
|
||||
* user_set_password()
|
||||
*
|
||||
* Change the user password.
|
||||
*
|
||||
* <handle> is the database handle.
|
||||
* <name> is the user name.
|
||||
* <password> is the new password
|
||||
*
|
||||
* This function returns TRUE if the command has failed, and FALSE if
|
||||
* everything was OK.
|
||||
*
|
||||
* Sqlite : No user passwords.
|
||||
******************************************************************************/
|
||||
|
||||
static int user_set_password(DB_DATABASE *db, const char *name, const char *password)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue