Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5949181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:12:46+00:00 2026-05-22T17:12:46+00:00

I would like to take the following unit (DrivesData) and display the drive column

  • 0

I would like to take the following unit (DrivesData) and display the drive column in a TListView. I’ve never worked with the (Synopse) SQLite3 code before so I’m hoping someone could give me a little push in the right direction.

Just add the DrivesData unit to the uses clause then run and it will create the “drives.sqlite” database file with a list of drives ‘A’ to ‘Z’.

unit DrivesData;

interface

uses
  SynCommons, SQLite3Commons;

type
  TDrives = class(TSQLRecord)
  private
    { Private declarations }
    FDrive: RawUTF8;
  protected
    { Protected declarations }
    FDrivesModel: TSQLModel;
    FDrivesDatabase: TSQLRest;
  public
    { Public declarations }
    constructor Create(); override;
    destructor Destroy(); override;
  published
    { Published declarations }
    property Drive: RawUTF8 read FDrive write FDrive;
  end;

var
  DriveRecord: TDrives;

implementation

uses
  SQLite3;

function CreateDrivesModel(): TSQLModel;
begin
  Result := TSQLModel.Create([TDrives]);
end;

{ TDrives }
constructor TDrives.Create();
var
  X: Char;
begin
  inherited Create();

  FDrivesModel := CreateDrivesModel();
  FDrivesDatabase := TSQLRestServerDB.Create(FDrivesModel, 'drives.sqlite');

  TSQLRestServerDB(FDrivesDatabase).DB.Execute(
    'CREATE TABLE IF NOT EXISTS drives ' +
    '(id INTEGER PRIMARY KEY, drive TEXT NOT NULL UNIQUE COLLATE NOCASE);');

  for X := 'A' to 'Z' do
  begin
    TSQLRestServerDB(FDrivesDatabase).DB.Execute(
      'INSERT OR IGNORE INTO drives (drive) VALUES ("' + X + ':")');
  end;
end;

destructor TDrives.Destroy();
begin
  if Assigned(FDrivesDatabase) then
    FDrivesDatabase.Free();

  if Assigned(FDrivesModel) then
    FDrivesModel.Free();

  inherited Destroy();
end;

initialization
  DriveRecord := TDrives.Create();

finalization
  if Assigned(DriveRecord) then
    DriveRecord.Free();

end.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:12:47+00:00Added an answer on May 22, 2026 at 5:12 pm

    Nice try!

    But I’m afraid you are missing some points of the framework:

    • for instance you’re mixing record level and MVC application level: a TSQLRecord maps a DB table and you should not declare MVC TSQLModel and TSQLRest inside this class;
    • and you’re missing the ORM approach, you don’t need to write all those SQL code (the CREATE TABLE and the INSERT): the framework will write it for you, with no error, and the exact expected column type (with collations)!

    Instead of using a TSQLRestServerDB directly by itself, you should better use a TSQLRestClientDB (which will instantiate its privately owned TSQLRestServerDB), even if you are still working locally. So you’ll get a lot more features with no performance penalty.

    You are using a Char type in your code. Our framework is UTF-8 oriented, so you should use AnsiChar instead, or use StringToUtf8() function to ensure correctness (at least with Unicode version of Delphi).

    I’ll recommend that you take a look at the sample code source code and the provided documentation (especially the SAD document, in the general presentation in the first pages, including the SynFile main demo).

    To retrieve some data, then display it in the VCL (e.g. in a TListBox), take a look at the TSQLTableJSON class. There are some code sample in the SAD document (take a look at the keyword index, at the beginning of the document, if you’re a bit lost).

    Perhaps StackOverflow is not the best place to ask such specific questions. You have our forum available at http://synopse.info to post any questions regarding this framework. You can post your code here.

    Thanks for your interest!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code is not working correctly. I would like to take the following
I would like to take the following array and generate a new array that
I am using Apache 2.2 and mod_rewrite. I would like to take the following
So, the idea is that I would take the following code used to run
In R, I have the following expression for which I would like to take
I would like to take a string representation of a set and parse it.
I would like to take a field and replace all characters that are not
I would like to take a specific part of the last line of a
I would like to take the memory generated from my struct and push it
I would like to take the words of a sentence, if that word has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.