🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.vdbase.data.sql
Article #1521

Re: Problem with Order Tag on SQL Tables

#1521
From: Ken Chan
Date: Thu, 18 Dec 1997 00:00
70 lines
2708 bytes
Romain Strieff [TeamB] wrote:

> Mmm, didn't he want to know how it is done with SQL, especially if the 
> order is an expression and no field? How'd you do that? 

Apparently not. He posted the solution using USE

> Or is VdB the only program in the world using expression indexes? 

DBFs are the only ones (that I know of) that use _expression_ indexes:

  last_name + first_name
  last_name + "asdfasd" + upper( substr( ltrim( first_name ), 2, 4 ))

Most other databases support compound, or multi-field indexes:

  last_name, first_name

> and show us an example of DbiGetSysConfig which should be possible now 
> that we have the BDE session and cursor handle available?

That function has nothing to do with BDE handles. Perhaps you mean 
something else? Anyway, after some tinkering <g> here is the call using 
my VSTRUCT stuff, which I will post in the Programming section.

#include <VSTRUCT.H>

#define DBIRESULT 	CSHORT
#define DBIBOOL   	TYPE_BOOL16

#define DBIMAXNAMELEN           31
#define DBIMAXPATHLEN           260
#define DBIMAXUSERNAMELEN       14

#define DBIPATH         TYPE_STRING(DBIMAXPATHLEN+1)
#define DBINAME         TYPE_STRING(DBIMAXNAMELEN+1)
#define DBIUSERNAME     TYPE_STRING(DBIMAXUSERNAMELEN+1)

set procedure to VSTRUCT additive

VSTRUCT_DEF( "BDESysConfig", ;
  "LocalShare" , DBIBOOL, ;
  "NetProtocol", TYPE_USHORT, ; // Not currently used.
  "NetShare"   , DBIBOOL, ;     // Not currently used.
  "NetType"    , DBINAME, ;	
  "UserName"   , DBIUSERNAME, ;
  "IniFile"    , DBIPATH, ;
  "LangDriver" , DBINAME ;
)

extern DBIRESULT DbiGetSysConfig ( CPTR ) IDAPI32

c = new VStruct( "BDESysConfig" )

if ( DbiGetSysConfig( c ) == 0 )
  a = { "LocalShare", "NetType", "UserName", "IniFile", "LangDriver" }
  for n = 1 to a.size
    ? transform( a[ n ], replicate( "X", 12 ) + ":" ), c.getMem( a[ n ] )
  endfor
endif


The hard part was figuring out all the buffer sizes, which are listed in 
the BDE API Help under "Constants" and "Buffer:typedefs". The booleans 
are also 16 bits instead of 32.

-- 
//Ken[0]@Borland
<Please follow-up to newsgroup; do not reply to email>
Technical Details
Message-ID: <MPG.f037b20d04f7ac8989763@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <01bd0a7b$56007e50$74ffc2d0@wells> <MPG.f01fde638bbf0e98975b@forums.borland.com> <MPG.f02971e4f5ae88898a1f0@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,3ddd9c9af1c9a349
X-Google-Attributes: gidff5a1,public
From: supportinfo@borland.com (Ken Chan)
Subject: Re: Problem with Order Tag on SQL Tables
Date: 1997/12/18
Message-ID: <MPG.f037b20d04f7ac8989763@forums.borland.com>
X-Deja-AN: 308462622
References: <01bd0a7b$56007e50$74ffc2d0@wells> <MPG.f01fde638bbf0e98975b@forums.borland.com> <MPG.f02971e4f5ae88898a1f0@forums.borland.com>
Organization: Borland
Newsgroups: borland.public.vdbase.data.sql