GXSQLSRV class

class geosoft.gx.GXSQLSRV
SQL Server and MSDE utility functions
static attach_mdf((GXContext)ctx, (str)arg1, (str)arg2, (str)arg3, (str)arg4, (str)arg5, (str)arg6) → int:
Attaches an MDF SQL server file to a server.
Parameters:
  • ctx (geosoft.gx.GXContext) – The GX execution context
  • arg1 (str) – SQL server to use
  • arg2 (str) – User name (if blank assume NT Integrated Security)
  • arg3 (str) – Password
  • arg4 (str) – DB name
  • arg5 (str) – MDF name
  • arg6 (str) – LDF name (if blank, tries single db attach)
Returns:

0 - OK 1 - DB Operation Canceled Terminates on Error

Return type:

int

New in version 5.1.8.

Note:

The file's path need to be visible as local files on the server.
Network drives and substitutes may not work.
static detach_db((GXContext)ctx, (str)arg1, (str)arg2, (str)arg3, (str)arg4) → int:
Detaches a SQL Server database from a server.
Parameters:
  • ctx (geosoft.gx.GXContext) – The GX execution context
  • arg1 (str) – SQL server to use
  • arg2 (str) – User name (if blank assume NT Integrated Security)
  • arg3 (str) – Password
  • arg4 (str) – DB name
Returns:

0 - OK 1 - DB Operation Canceled

Return type:

int

New in version 5.1.8.

static get_database_languages_lst((GXContext)ctx, (GXLST)arg1, (str)arg2, (str)arg3, (str)arg4, (int)arg5) → int:
Get a list of the languages into LST
Parameters:
  • ctx (geosoft.gx.GXContext) – The GX execution context
  • arg1 (geosoft.gx.GXLST) – LST
  • arg2 (str) – SQL server to use
  • arg3 (str) – User name
  • arg4 (str) – Password
  • arg5 (int) – 0 - SQL authentication, 1 - NT integrated securty
Returns:

Number of languages

Return type:

int

New in version 5.1.8.

static get_databases_lst((GXContext)ctx, (GXLST)arg1, (str)arg2, (str)arg3, (str)arg4, (int)arg5) → int:
Get a list of the database into LST
Parameters:
  • ctx (geosoft.gx.GXContext) – The GX execution context
  • arg1 (geosoft.gx.GXLST) – LST
  • arg2 (str) – SQL server to use
  • arg3 (str) – User name
  • arg4 (str) – Password
  • arg5 (int) – 0 - SQL authentication, 1 - NT integrated securty
Returns:

Number of database

Return type:

int

New in version 5.1.8.

static get_login_gui((GXContext)ctx, (str)arg1, (str_ref)arg2, (str_ref)arg3, (int)arg4, (int_ref)arg5) → None:
Get/Test login information to SQL Server
Parameters:
Returns:

Nothing

Return type:

None

New in version 5.1.8.

static get_servers_lst((GXContext)ctx, (GXLST)arg1) → int:
Get a list of the visible servers into LST
Parameters:
Returns:

Number of servers

Return type:

int

New in version 5.1.8.

MFCSQL_DRIVER constants

SQL Server Driver
gx.MFCSQL_DRIVER_NOPROMPT = 0
No dialog box, Error if authentication parameters are wrong
gx.MFCSQL_DRIVER_COMPLETE = 1
Only shows dialog box if authentication parameters are wrong
gx.MFCSQL_DRIVER_PROMPT = 2
Always show dialog box, with option to change parameter
gx.MFCSQL_DRIVER_COMPLETE_REQUIRED = 3
Same as MFCSQL_DRIVER_COMPLETE except only missing parameters are editable