Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | enhanced TSQLDBZEOSConnectionProperties.GetFields() to support database schema information |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
e02f768d511aef4f41d8737666a410ef |
User & Date: | abouchez 2013-11-29 14:27:38 |
2013-11-29
| ||
14:28 | support FireDAC naming breaking changes introduced with Delphi XE5 check-in: c2a95794b2 user: abouchez tags: trunk | |
14:27 | enhanced TSQLDBZEOSConnectionProperties.GetFields() to support database schema information check-in: e02f768d51 user: abouchez tags: trunk | |
14:26 | enhanced TSQLDBConnectionProperties.SQLTableName() method to support several identified SQL dialects check-in: c0e6012df8 user: abouchez tags: trunk | |
Changes to SynDB.pas.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
The Initial Developer of the Original Code is Arnaud Bouchez. Portions created by the Initial Developer are Copyright (C) 2013 the Initial Developer. All Rights Reserved. Contributor(s): Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which case the provisions of the GPL or the LGPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of either the GPL or the LGPL, and not to allow others to use your version of this file under the terms of the MPL, indicate your |
> > > |
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
The Initial Developer of the Original Code is Arnaud Bouchez.
Portions created by the Initial Developer are Copyright (C) 2013
the Initial Developer. All Rights Reserved.
Contributor(s):
- delphinium
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
|
Changes to SynDBZEOS.pas.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 ... 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 ... 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
The Initial Developer of the Original Code is Arnaud Bouchez. Portions created by the Initial Developer are Copyright (C) 2013 the Initial Developer. All Rights Reserved. Contributor(s): Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which case the provisions of the GPL or the LGPL are applicable instead of those above. If you wish to allow use of your version of this file only ................................................................................ end; procedure TSQLDBZEOSConnectionProperties.GetFields( const aTableName: RawUTF8; var Fields: TSQLDBColumnDefineDynArray); var meta: IZDatabaseMetadata; res: IZResultSet; n, i: integer; TableName: string; F: TSQLDBColumnDefine; FA: TDynArray; begin if GetDatabaseMetadata(meta) then begin TableName := UTF8ToString(UpperCase(aTableName)); res := meta.GetColumns('','',TableName,''); FA.Init(TypeInfo(TSQLDBColumnDefineDynArray),Fields,@n); FA.Compare := SortDynArrayAnsiStringI; // FA.Find() case insensitive FillChar(F,sizeof(F),0); while res.Next do begin F.ColumnName := SynUnicodeToUtf8(res.GetUnicodeString(4)); F.ColumnTypeNative := SynUnicodeToUtf8(res.GetUnicodeString(6)); F.ColumnType := TZSQLTypeToTSQLDBFieldType(TZSQLType(res.GetInt(5))); F.ColumnLength := res.GetInt(7); F.ColumnPrecision := res.GetInt(9); ................................................................................ if i>=0 then Fields[i].ColumnIndexed := true; end; end; SetLength(Fields,n); exit; end; inherited; end; function TSQLDBZEOSConnectionProperties.TZSQLTypeToTSQLDBFieldType(aNativeType: TZSQLType): TSQLDBFieldType; begin case aNativeType of stBoolean, stByte, stShort, stInteger, stLong: result := ftInt64; |
> | | | | < | |
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 ... 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 ... 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
The Initial Developer of the Original Code is Arnaud Bouchez. Portions created by the Initial Developer are Copyright (C) 2013 the Initial Developer. All Rights Reserved. Contributor(s): - delphinium Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which case the provisions of the GPL or the LGPL are applicable instead of those above. If you wish to allow use of your version of this file only ................................................................................ end; procedure TSQLDBZEOSConnectionProperties.GetFields( const aTableName: RawUTF8; var Fields: TSQLDBColumnDefineDynArray); var meta: IZDatabaseMetadata; res: IZResultSet; n, i: integer; Schema, TableName: RawUTF8; F: TSQLDBColumnDefine; FA: TDynArray; begin if GetDatabaseMetadata(meta) then begin SQLSplitTableName(UpperCase(aTablename), Schema,TableName); res := meta.GetColumns('',UTF8ToString(Schema),UTF8ToString(TableName),''); FA.InitSpecific(TypeInfo(TSQLDBColumnDefineDynArray),Fields,djRawUTF8,@n,true); FillChar(F,sizeof(F),0); while res.Next do begin F.ColumnName := SynUnicodeToUtf8(res.GetUnicodeString(4)); F.ColumnTypeNative := SynUnicodeToUtf8(res.GetUnicodeString(6)); F.ColumnType := TZSQLTypeToTSQLDBFieldType(TZSQLType(res.GetInt(5))); F.ColumnLength := res.GetInt(7); F.ColumnPrecision := res.GetInt(9); ................................................................................ if i>=0 then Fields[i].ColumnIndexed := true; end; end; SetLength(Fields,n); exit; end; inherited; // if ZDBC metadata failed -> fall back to generic SQL-based code end; function TSQLDBZEOSConnectionProperties.TZSQLTypeToTSQLDBFieldType(aNativeType: TZSQLType): TSQLDBFieldType; begin case aNativeType of stBoolean, stByte, stShort, stInteger, stLong: result := ftInt64; |