Drop table and recreate if exist in sqflite flutter2019 Community Moderator ElectionFlutter Sqflite multiple table modelsFlutter - How to update the table structure in Sqflite?How to do a database insert with SQFlite in FlutterHow to get the number of rows in a database table with Flutter SQFliteHow to do a database update with SQFlite in FlutterHow to do a database query with SQFlite in FlutterHow to create multiple tables in a database in sqflite?Flutter: How to load data in main.dart and sync json to sqfliteHow to get the total of column values in sqflite in flutter?How can I know if row is exist in flutter sqflite?

They call me Inspector Morse

Set and print content of environment variable in cmd.exe subshell?

Latest web browser compatible with Windows 98

Solving "Resistance between two nodes on a grid" problem in Mathematica

Is it possible to have an Abelian group under two different binary operations but the binary operations are not distributive?

Are babies of evil humanoid species inherently evil?

Does "variables should live in the smallest scope as possible" include the case "variables should not exist if possible"?

Can you reject a postdoc offer after the PI has paid a large sum for flights/accommodation for your visit?

Why is Beresheet doing a only a one-way trip?

What Happens when Passenger Refuses to Fly Boeing 737 Max?

Placing subfig vertically

Time travel short story where dinosaur doesn't taste like chicken

Fourth person (in Slavey language)

Things to avoid when using voltage regulators?

Are the terms "stab" and "staccato" synonyms?

Why doesn't this Google Translate ad use the word "Translation" instead of "Translate"?

Regex for certain words causes Spaces

How do I express some one as a black person?

Reverse string, can I make it faster?

How strictly should I take "Candidates must be local"?

Why the color red for the Republican Party

What are some noteworthy "mic-drop" moments in math?

Extra alignment tab has been changed to cr. } using table, tabular and resizebox

PTIJ: Why can't I eat anything?



Drop table and recreate if exist in sqflite flutter



2019 Community Moderator ElectionFlutter Sqflite multiple table modelsFlutter - How to update the table structure in Sqflite?How to do a database insert with SQFlite in FlutterHow to get the number of rows in a database table with Flutter SQFliteHow to do a database update with SQFlite in FlutterHow to do a database query with SQFlite in FlutterHow to create multiple tables in a database in sqflite?Flutter: How to load data in main.dart and sync json to sqfliteHow to get the total of column values in sqflite in flutter?How can I know if row is exist in flutter sqflite?










0















I want to drop table before populating server data if exist.



the Queries I'm trying



 deleteOptionTable() async 
final db = await database;
db.rawDelete("Delete * from option");

dropTable() async
final db = await database;
db.query('SELECT * FROM cloudnet360.db WHERE name =option and type=table');



I have tried something like this but nothing is happening.



void _insertOption(OptionsGroupList option) async 

int idd = dbHelper.dropTable();

print('DROP TABLE: $idd');

PreferencesConnector myprefs= PreferencesConnector();
String merchantid=await myprefs.readString('merchantid');
String hashkey=await myprefs.readString('hashkey');

Map<String, dynamic> row =
DatabaseHelper.columnGroupId:option.grouprowid ,
DatabaseHelper.columnGroupName: option.groupname,
DatabaseHelper.columnIsRequired:option.isrequired ,
DatabaseHelper.columnMerchantId: merchantid,
DatabaseHelper.columnMerchantHashKey: hashkey,
;
int id = await dbHelper.insertOption(row);

print('inserted option row id: $id');










share|improve this question






















  • Don't understand flutter but ... the select statement in dropTable() will drop the table??

    – AIMIN PAN
    Mar 7 at 7:46











  • @AIMINPAN I'm unable to drop the table .

    – farhana
    Mar 7 at 7:59











  • did you try int idd = await dbHelper.dropTable();? I assume it's async

    – TruongSinh
    Mar 7 at 11:16















0















I want to drop table before populating server data if exist.



the Queries I'm trying



 deleteOptionTable() async 
final db = await database;
db.rawDelete("Delete * from option");

dropTable() async
final db = await database;
db.query('SELECT * FROM cloudnet360.db WHERE name =option and type=table');



I have tried something like this but nothing is happening.



void _insertOption(OptionsGroupList option) async 

int idd = dbHelper.dropTable();

print('DROP TABLE: $idd');

PreferencesConnector myprefs= PreferencesConnector();
String merchantid=await myprefs.readString('merchantid');
String hashkey=await myprefs.readString('hashkey');

Map<String, dynamic> row =
DatabaseHelper.columnGroupId:option.grouprowid ,
DatabaseHelper.columnGroupName: option.groupname,
DatabaseHelper.columnIsRequired:option.isrequired ,
DatabaseHelper.columnMerchantId: merchantid,
DatabaseHelper.columnMerchantHashKey: hashkey,
;
int id = await dbHelper.insertOption(row);

print('inserted option row id: $id');










share|improve this question






















  • Don't understand flutter but ... the select statement in dropTable() will drop the table??

    – AIMIN PAN
    Mar 7 at 7:46











  • @AIMINPAN I'm unable to drop the table .

    – farhana
    Mar 7 at 7:59











  • did you try int idd = await dbHelper.dropTable();? I assume it's async

    – TruongSinh
    Mar 7 at 11:16













0












0








0








I want to drop table before populating server data if exist.



the Queries I'm trying



 deleteOptionTable() async 
final db = await database;
db.rawDelete("Delete * from option");

dropTable() async
final db = await database;
db.query('SELECT * FROM cloudnet360.db WHERE name =option and type=table');



I have tried something like this but nothing is happening.



void _insertOption(OptionsGroupList option) async 

int idd = dbHelper.dropTable();

print('DROP TABLE: $idd');

PreferencesConnector myprefs= PreferencesConnector();
String merchantid=await myprefs.readString('merchantid');
String hashkey=await myprefs.readString('hashkey');

Map<String, dynamic> row =
DatabaseHelper.columnGroupId:option.grouprowid ,
DatabaseHelper.columnGroupName: option.groupname,
DatabaseHelper.columnIsRequired:option.isrequired ,
DatabaseHelper.columnMerchantId: merchantid,
DatabaseHelper.columnMerchantHashKey: hashkey,
;
int id = await dbHelper.insertOption(row);

print('inserted option row id: $id');










share|improve this question














I want to drop table before populating server data if exist.



the Queries I'm trying



 deleteOptionTable() async 
final db = await database;
db.rawDelete("Delete * from option");

dropTable() async
final db = await database;
db.query('SELECT * FROM cloudnet360.db WHERE name =option and type=table');



I have tried something like this but nothing is happening.



void _insertOption(OptionsGroupList option) async 

int idd = dbHelper.dropTable();

print('DROP TABLE: $idd');

PreferencesConnector myprefs= PreferencesConnector();
String merchantid=await myprefs.readString('merchantid');
String hashkey=await myprefs.readString('hashkey');

Map<String, dynamic> row =
DatabaseHelper.columnGroupId:option.grouprowid ,
DatabaseHelper.columnGroupName: option.groupname,
DatabaseHelper.columnIsRequired:option.isrequired ,
DatabaseHelper.columnMerchantId: merchantid,
DatabaseHelper.columnMerchantHashKey: hashkey,
;
int id = await dbHelper.insertOption(row);

print('inserted option row id: $id');







android dart flutter sqflite






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 7:42









farhanafarhana

2,63552235




2,63552235












  • Don't understand flutter but ... the select statement in dropTable() will drop the table??

    – AIMIN PAN
    Mar 7 at 7:46











  • @AIMINPAN I'm unable to drop the table .

    – farhana
    Mar 7 at 7:59











  • did you try int idd = await dbHelper.dropTable();? I assume it's async

    – TruongSinh
    Mar 7 at 11:16

















  • Don't understand flutter but ... the select statement in dropTable() will drop the table??

    – AIMIN PAN
    Mar 7 at 7:46











  • @AIMINPAN I'm unable to drop the table .

    – farhana
    Mar 7 at 7:59











  • did you try int idd = await dbHelper.dropTable();? I assume it's async

    – TruongSinh
    Mar 7 at 11:16
















Don't understand flutter but ... the select statement in dropTable() will drop the table??

– AIMIN PAN
Mar 7 at 7:46





Don't understand flutter but ... the select statement in dropTable() will drop the table??

– AIMIN PAN
Mar 7 at 7:46













@AIMINPAN I'm unable to drop the table .

– farhana
Mar 7 at 7:59





@AIMINPAN I'm unable to drop the table .

– farhana
Mar 7 at 7:59













did you try int idd = await dbHelper.dropTable();? I assume it's async

– TruongSinh
Mar 7 at 11:16





did you try int idd = await dbHelper.dropTable();? I assume it's async

– TruongSinh
Mar 7 at 11:16












1 Answer
1






active

oldest

votes


















0














Indeed your dropTable method does not seem to actually drop any table:



To delete (drop) a table:



DROP TABLE IF EXISTS my_table


To clear a table content:



DELETE FROM my_table





share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55038488%2fdrop-table-and-recreate-if-exist-in-sqflite-flutter%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Indeed your dropTable method does not seem to actually drop any table:



    To delete (drop) a table:



    DROP TABLE IF EXISTS my_table


    To clear a table content:



    DELETE FROM my_table





    share|improve this answer



























      0














      Indeed your dropTable method does not seem to actually drop any table:



      To delete (drop) a table:



      DROP TABLE IF EXISTS my_table


      To clear a table content:



      DELETE FROM my_table





      share|improve this answer

























        0












        0








        0







        Indeed your dropTable method does not seem to actually drop any table:



        To delete (drop) a table:



        DROP TABLE IF EXISTS my_table


        To clear a table content:



        DELETE FROM my_table





        share|improve this answer













        Indeed your dropTable method does not seem to actually drop any table:



        To delete (drop) a table:



        DROP TABLE IF EXISTS my_table


        To clear a table content:



        DELETE FROM my_table






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 8 at 18:52









        alextkalextk

        1,8361220




        1,8361220





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55038488%2fdrop-table-and-recreate-if-exist-in-sqflite-flutter%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

            Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

            How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page